Takahiro Sasaki wrote:
I created the HSSFWorkbook with Microsoft Excel.
The numeric cell value gets converted into the wrong value in the
resultant HSSFCell in the numeric type.
The value 0.769 in the file is converted to 0.7689999999999999 by
LittleEndian in the fillFields(RecordInputStream in) method in
NumberRecord class.
If I save the file as a csv file and then save back as a xls file, this
problem doesn't happen.
Does any body know what is causing this problem?  If this is a known
bug, is there any work around?

It's not a bug but a misunderstanding. Floating point numbers will do this from time to time. The workaround is that if you know you want three decimal places, you can format it to three decimal places instead of using String.valueOf/Double.toString.

Daniel


--
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://nuix.com/                               Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

Reply via email to