You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Richard Holmes <ri...@shedconsulting.co.uk> on 2010/04/26 12:19:29 UTC

Re: why only double for cell.setCellValue? BigDecimal/Long/Integer

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 <ni...@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
>