Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to change Data type of Number & Date using Poi Excel export.?

M Yaa SerFeb 19 2018 — edited Feb 20 2018

Hello Developers,

I am using Jdeveloper 12.2.1. My requirement is to export data into excel that is working perfectly. but when I open excel so all the data comes into General(String) format and I want

Number into Number format and Date into Date format.

I used below code to change format for Date but its still coming in general(String) Format.

(("Birthdate".equalsIgnoreCase(colName))) {

                            CellStyle cellStyle = workbook.createCellStyle();

                            CreationHelper createHelper = workbook.getCreationHelper();

                            cellStyle.setDataFormat(

                                createHelper.createDataFormat().getFormat("dd-MMM-yy"));

                            cell.setCellValue(CellValue);

                            cell.setCellStyle(cellStyle);

Please help.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2018
Added on Feb 19 2018
6 comments
2,966 views