poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Defoort <filip...@cirquedigital.com>
Subject bug in cell.setCellType(Cell.CELL_TYPE_NUMERIC) (POI 3.6)
Date Tue, 05 Jan 2010 19:38:18 GMT

I've just stumbled across a bug in POI 3.6:


doesn't work if the cell is anything other than blank or a numeric
cell - which kinda defeats the purpose of the whole thing...

It turns out that HSSFCell.java does a


as part of the setCellType() call (XSSF doesn't have this problem).

The workaround is to first set the cell type to blank, then to numeric, like so:


While we're on the subject, I've never understood why
getNumericCellValue() doesn't try to parse the string value in case of
a text cell ? I wouldn't expect that to cause any bad side effects ?
(in fact, excel displays a warning when it detects this situation).

Hopefully someone can put a fix in for this in 3.7...

- Filip

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message