Summary: | NaN Cell Value appears as 3.48484087130803E+308 | ||
---|---|---|---|
Product: | POI | Reporter: | Rodrigo Vega <rodrigo.vega.bs.as.arg> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All |
Description
Rodrigo Vega
2006-07-12 12:17:39 UTC
(In reply to comment #0) > When i try to put into a cell this > > <javaCode> > row.createCell((short) 11).setCellValue(productos.getImporte().doubleValue()); > </javaCode> > > and doubleValue() return zero... in xls appears 3.48484087130803E+308 Sorry doubleValue() don't return zero, it return NaN IEEE NaN is a little bit tricky, and Excel makes a big mess of it. I believe if you put NaN in a formula (encoding that value in a NumberPtg) Excel will display '#NUM!', which is sort of expected. Excel seems to get NaN wrong for a (non formula) cell with a plain number value. Perhaps the most consistent way to translate the concept of NaN to an Excel cell value would be to set the error code value to '#NUM!'. The following code can do that: if(Double.isNaN(d)) { cell.setCellErrorValue(HSSFErrorConstants.ERROR_NUM); } else { cell.setCellValue(d); } |