poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <nick.bu...@alfresco.com>
Subject Re: Reading Cells formated with General as text data
Date Tue, 08 Feb 2011 12:38:28 GMT
On Tue, 8 Feb 2011, John Francis wrote:
> The problem comes with the numeric values. Here POI reads the values and 
> sets the cell type to be CELL_TYPE_NUMERIC. This returns the value as a 
> double. The trouble is the code '366.0' is not the same code as '366' so 
> I wish to get the value 'as entered'. I appreciate that Excel may have 
> decided to store the value internally as a double, and there is no way 
> to get the value back 'as it appears'. Is this the case, or does POI 
> have some access to a lower level value?

Generally if you type a number into a cell in excel, excel will store it 
as a double.

The DataFormatter class will probably do what you want though, as it tries 
to replicate the formatting rules in excel to be able to format numbers as 
strings in the same way excel does


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

View raw message