You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Dave <ja...@yahoo.com> on 2010/04/25 11:38:08 UTC
why only double for cell.setCellValue? BigDecimal/Long/Integer
Hello, we are working on financial area. The number types are BigDecimal, Long and Integer type.
But the Cell.setCellValue(...) has double type for numeric, it does not have method for BigDecimal, Long and Integer.
If converting these types to double, it lost accuracy. If we use String, the Excel will complain about the numbers as String, and ask if converting them to numbers. Excel should see them as numbers.
Thanks for help.
Dave
Re: why only double for cell.setCellValue? BigDecimal/Long/Integer
Posted by Richard Holmes <ri...@shedconsulting.co.uk>.
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
>
Re: why only double for cell.setCellValue?
BigDecimal/Long/Integer
Posted by Nick Burch <ni...@alfresco.com>.
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