Java - formatting a number and exporting to excel doc

2.3k views Asked by At

From a java class i am exporting the value 54666700 to a .xlsx document. I want to display it as $54,666,700, but in the document it should be stored as 54666700, i.e., when i select that column the value should be selected as number 54666700.

As far as formatting to currency i am using the below code.

Long newsValue = 54666700
NumberFormat testFormat = NumberFormat.getCurrencyInstance(Locale.US);
testFormat.setMinimumFractionDigits(0);
String currency = testFormat.format(current);
//which will be $54,666,700

I found this library Apache DataFormatter, but unable to figure out how to get the CELL object there.

Any advice/tips appreciated.

0

There are 0 answers