Srikanth Sridhar Srikanth Sridhar - 21 days ago 5
Java Question

How to display Indian Numbering format in iReport?

I am using iReports to generate Reports. I want to display the GrandTotal fields in Indian Numbering Format.
For Example,

Value: 1,000,000 should be displayed as 10,00,000


I tried using Pattern of text field properties, but not able to get the result.
And in some forums they have mentioned to use JRParameter.REPORT_LOCALE. I tried this way

Locale locale = new Locale("en", "IN");
parameters.put(JRParameter.REPORT_LOCALE, locale);


where parameters is a map which is then used to fill report.

Any help is appreciated

Thanks

Answer

If you use ICU4J you can do something like

com.ibm.icu.text.NumberFormat.getCurrencyInstance(new Locale("en", "in")).format(new Java.math.BigDecimal(${FIELD_HOLDING_THE_VALUE}));

NumberFormat of ICU4J is explained in this thread

Comments