I am using JXL (JExcelAPI) to write data to excel. One of the columns is date column and I am adding a lot of rows per sheet (225+). I have 3 sheets and each sheet has a date column.
First sheet works fine. Second sheet works fine up to like 40 rows and then after that, instead of a date formatted value, I get just numerical value such as 42217.75. 3rd sheet continues to be numerical. Here is the method I am call
public void writeCell(int columnPosition, int rowPosition, Date date, String format,
WritableSheet sheet) throws RowsExceededException, WriteException{
DateFormat customDateFormat = new DateFormat (format);
WritableCellFormat dateFormat = new WritableCellFormat (customDateFormat);
DateTime dateCell = new DateTime(columnPosition, rowPosition, date, dateFormat);
sheet.addCell(dateCell);
}
And here is the calling block which offcourse is being called in a loop per sheet
writeCell(col,rows,task.getDateTime(),"dd-MMM-yyyy hh:mm",sheet);
Any idea why this is happening?