Dates are numeric cells as far as excel and POI are concerned. Good, bad, or ugly... that's just how excel stores date values. To get the formatted string value of a date, or other numeric cell, use the formatCellValue(HSSFCell) method on an instance of HSSFDataFormatter. See http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFDataForm atter.html
This is a new class that is in svn trunk right now. James -----Original Message----- From: Ravi Sundaar [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2008 11:11 AM To: [email protected] Subject: problem with date values in cells - POI thinks these are numeric cells I have spreadsheets that contains values like "5/10/2008". When I inspect the cell, the type of the cell that contains these kind of date values (using getCellType), the type is HSSFCell.CELL_TYPE_NUMERIC and not HSSFCell.CELL_TYPE_STRING. I am able to retrieve the value only using getNumericCellValue() and not getRichStringCellValue() as for strings. The value I retrieve looks something like 39581.0 because of this. The interesting quirk is that, if the value is "15/10/2008" everything works ok. The API recognizes the cell as a string and retrieves appropriately. Is there a workaround for this problem? Thanks, Ravi. _________________________________________________________________ Got Game? Win Prizes in the Windows Live Hotmail Mobile Summer Games Trivia Contest http://www.gowindowslive.com/summergames?ocid=TXT_TAGHM --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
