Carlos,
This should be helpful:
java.text.DecimalFormat de = new
java.text.DecimalFormat("#,##0");
String numericString =
de.format(Double.parseDouble(value)).toString();
Try this format.
Thanks,
Anuj
-----Original Message-----
From: Carlos Bergueira [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 01, 2005 12:32 PM
To: POI Users List; [EMAIL PROTECTED]
Subject: Re: Float value into Cell
Thanks for help.
I formatted as "0.00" but when I check value in excel file value in cell
is:
49,4700012207031
The value I want here is: 49,47
Any way to solve it ?
On 01/11/05, Amol Deshmukh <[EMAIL PROTECTED]> wrote:
>
> Carlos,
>
> There is no integer "datatype" for excel, all numeric
> values are stored as doubles. I suspect your problem
> may have something to do with the cell format.
>
> These may help you:
>
>
http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSF
Data
> Format.html
>
> http://jakarta.apache.org/poi/hssf/quick-guide.html#DataFormats
>
> ~ amol
>
>
> > -----Original Message-----
> > From: Carlos Bergueira [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, November 01, 2005 11:33 AM
> > To: POI Users List
> > Subject: Float value into Cell
> >
> >
> > Hi All,
> >
> > I really need to put a float value into a cell.
> >
> > This is what I have done:
> >
> >
> >
> > HSSFRow row = sheet.createRow( (short) currentNoOfExcelRows);
> >
> > HSSFCell debit = row.createCell( (short) 1);
> > HSSFCell credit = row.createCell( (short) 2);
> >
> > debit.setCellValue(account.getDebit()); // get the debit from
> > database where
> > datatype is float
> > credit.setCellValue(account.getCredit()); // get the credit
> > from database
> > where datatype is float
> >
> >
> >
> >
> > The result is an integer value !
> > Help is appreciated.
> > Thanks.
> >
> > --
> > Cumprts,
> > Carlos Bergueira
> >
>
> ---------------------------------------------------------------------
> 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/
>
>
--
Cumprts,
Carlos Bergueira
E-MAIL CONFIDENTIALITY NOTICE: The contents of this e-mail message and any
attachments are intended solely for the
addressee(s) and may contain confidential and/or legally privileged
information. If you are not the
intended recipient of this message or if this message has been addressed to you
in error, please
immediately alert the sender by reply e-mail and then delete this message and
any attachments. If you
are not the intended recipient, you are notified that any use, dissemination,
distribution, copying, or
storage of this message or any 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/