You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by sangram anand <sa...@gmail.com> on 2012/10/22 10:25:01 UTC
Currency Formatting using POI
Hi Team,
Using the apache poi library am generating a excel sheet. I get values from
a backend sir via api calls, like 3650030. I have to format it to $3,650,030
in the Cell, but in the formula bar it should appear just a number. I am
assuming that DataFormatter.addFormat(string, Format format) is the
correct one to format the number to currency and save it in a Cell of the
generated spreadsheet.
I am setting the value 3650030 to cell using the code
cell.setCellValue((Long) cols.get(jj).getValue());
I am using the
NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
numberFormat.setCurrency(Currency.getInstance(Locale.US));
dataFormatter.addFormat("($#,##0_);($#,##0)", numberFormat);
But how should i apply it to the cell object ?
Any help will be appreciated.
--
Thanks.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Currency-Formatting-using-POI-tp5711250.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Currency Formatting using POI
Posted by sangram anand <sa...@gmail.com>.
Hi Team,
Any advise/tips for the above requirement.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Currency-Formatting-using-POI-tp5711250p5711290.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Currency Formatting using POI
Posted by Yegor Kozlov <ye...@dinom.ru>.
http://poi.apache.org/spreadsheet/quick-guide.html#DataFormats
On Mon, Oct 22, 2012 at 12:25 PM, sangram anand <sa...@gmail.com> wrote:
> Hi Team,
>
> Using the apache poi library am generating a excel sheet. I get values from
> a backend sir via api calls, like 3650030. I have to format it to $3,650,030
> in the Cell, but in the formula bar it should appear just a number. I am
> assuming that DataFormatter.addFormat(string, Format format) is the
> correct one to format the number to currency and save it in a Cell of the
> generated spreadsheet.
>
> I am setting the value 3650030 to cell using the code
>
> cell.setCellValue((Long) cols.get(jj).getValue());
>
> I am using the
>
> NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
> numberFormat.setCurrency(Currency.getInstance(Locale.US));
> dataFormatter.addFormat("($#,##0_);($#,##0)", numberFormat);
>
> But how should i apply it to the cell object ?
>
> Any help will be appreciated.
>
> --
> Thanks.
>
>
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/Currency-Formatting-using-POI-tp5711250.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org