a***@gmail.com
2013-01-16 09:27:47 UTC
Hi,
I am using below code
HSSFCellStyle w_dateStyle = a_workBook.createCellStyle();
HSSFDataFormat w_hssDateFormat = a_workBook.createDataFormat();
w_dateStyle.setDataFormat(w_hssDateFormat.getFormat("dd-MMM-yyyy"));
HSSFRow w_row = null;
HSSFCell w_cell = null;
w_row = a_sheet.createRow((short) 0);
w_cell = w_row.createCell((short) 0);
w_cell.setCellValue(new Date());
w_cell.setCellStyle(w_dateStyle);
So this code generates Excel file with one cell which is having date value
in dd-MMM-yyyy format, but if you verify data type of same in Excel..it
shows as custom instead of Date.
Where as if style is set as
w_dateStyle.setDataFormat((short)0xe);
Then it gives date cell but it is not in dd-MMM-yyyy format, i want to get
cell in dd-MMM-yyyy format as well as it should be of Date type instead of
custom, how is it possible?
Thanks.
I am using POI 2.5.1 & MS Excel 2003.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Apache-POI-Date-cells-with-different-date-formats-generates-Excel-cell-with-custom-data-type-insteade-tp5711889.html
Sent from the POI - User mailing list archive at Nabble.com.
I am using below code
HSSFCellStyle w_dateStyle = a_workBook.createCellStyle();
HSSFDataFormat w_hssDateFormat = a_workBook.createDataFormat();
w_dateStyle.setDataFormat(w_hssDateFormat.getFormat("dd-MMM-yyyy"));
HSSFRow w_row = null;
HSSFCell w_cell = null;
w_row = a_sheet.createRow((short) 0);
w_cell = w_row.createCell((short) 0);
w_cell.setCellValue(new Date());
w_cell.setCellStyle(w_dateStyle);
So this code generates Excel file with one cell which is having date value
in dd-MMM-yyyy format, but if you verify data type of same in Excel..it
shows as custom instead of Date.
Where as if style is set as
w_dateStyle.setDataFormat((short)0xe);
Then it gives date cell but it is not in dd-MMM-yyyy format, i want to get
cell in dd-MMM-yyyy format as well as it should be of Date type instead of
custom, how is it possible?
Thanks.
I am using POI 2.5.1 & MS Excel 2003.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Apache-POI-Date-cells-with-different-date-formats-generates-Excel-cell-with-custom-data-type-insteade-tp5711889.html
Sent from the POI - User mailing list archive at Nabble.com.