Hi I forgot to mention clearly that this was not working only for XSSF documents.All HSSF documents behave the same way they used to before migration.
I would really appreciate any responses. Regards A -----Original Message----- From: Avinash Kewalramani [mailto:[email protected]] Sent: Monday, December 29, 2008 6:06 PM To: POI Users List Subject: Cell format for dates : CELL_TYPE_NUMERIC Hi I had some code which was reading HSSF documents and converting the cell values to a delimited text file.pretty straightforward. I changed that code to ss model so that it could read both hssf and xssf. For me most of it is working except for one small exceptional case I have a file with different date formats and one of them is 4/1/2007 format is date and type is *3/04/2001 (case1) The same data is repeated in the file with with format as date and type is 3/14/2001 works fine(case2) Here is the code snippet Cell cell; switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: String formatStr = cell.getCellStyle().getDataFormatString(); if (DateToString.isDateType(formatStr)) { ..date logic here.... }else{ ...non date logic here... } out of the above two data cases case 1 does not work but case 2 works just fine.I debugged and seems like the problem is the formatStr is being returned as null and it does not happen for the HSSF type of for XSSF with the other data type(case2).hence it does not enter the if loop where all the date logic is is this a bug in POI which has been documented or is this a bug in the underlying open xml schema implementation or am i really doing something weird here? anyone else seen this. any pointers/comments appreciated. Regards Avi --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
