Summary: | Excel does not recognize POI created cells as numbers | ||
---|---|---|---|
Product: | POI | Reporter: | Tammy Walters <tammy_walters> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED INVALID | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 2.5-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Attachments: | Example spreadsheet |
Description
Tammy Walters
2005-01-18 21:02:11 UTC
Created attachment 14041 [details]
Example spreadsheet
Note that the final two columns in the EODStats sheet have a sum formula at the
bottom of the column. The Qty Problems sum is 0, and the Waiting for Recpt sum
is 8 because I manually retyped the 8 in the column.
Code used to set the cell type of numeric: cellStyle = wb.createCellStyle(); cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT); cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); cell.setCellStyle(cellStyle); I found the root cause. Even though I set the cell type as numeric, when I set the cell value I passed in a String instead of a double. Changing my code to test for the string being a number and setting the value accordingly has fixed the error in the spreadsheet. Indeed. Actually, in the usual case ,you dont have to set cell type.. its automatically set based on the value you pass in. Maybe a FAQ? |