poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Holmes <rich...@shedconsulting.co.uk>
Subject Re: why only double for cell.setCellValue? BigDecimal/Long/Integer
Date Mon, 26 Apr 2010 10:19:29 GMT
Hi Dave,

It looks like your only option is to convert, I think the general rule is:

Used doubleValue to get the double (never use the toString)
If creating a BigDecimal create a string from the double first and create
the BigDecimal from the string.

I assume you have tried those?

Regards



On 26 April 2010 09:50, Nick Burch <nick.burch@alfresco.com> wrote:

> On Sun, 25 Apr 2010, Dave wrote:
>
>> But the Cell.setCellValue(...) has double type for numeric, it does not
>> have method for BigDecimal, Long and Integer.
>>
>
> The excel file format only supports storing doubles. Excel doesn't support
> anything else.
>
>
> If converting these types to double, it lost accuracy.
>>
>
> If you put them into excel by hand, it may show you a nicely formatted long
> or bigint, but it's really stored a double under the hood!
>
> Nick
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message