http://poi.apache.org/spreadsheet/quick-guide.html#DataFormats

On Mon, Oct 22, 2012 at 12:25 PM, sangram anand <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to