Srikanth Sridhar Srikanth Sridhar - 11 months ago 67
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


Answer Source

If you use ICU4J you can do something like Locale("en", "in")).format(new Java.math.BigDecimal(${FIELD_HOLDING_THE_VALUE}));

NumberFormat of ICU4J is explained in this thread