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