different number format in iReport and Jasper Server

Juraj Polak picture Juraj Polak · Apr 2, 2012 · Viewed 11.4k times · Source

i created report in iReport, where is text field with format:

new DecimalFormat("#,##0.00").format($F{NUMBER}) + " €"

In iReport result is 1 234,56 €, which is OK. I am in Slovakia and this is ordinary format here. In Jasper Server is result 1,234.56 € which is not OK.

Other question: There is still Sk (Slovak Crown) set for Slovakia. Is it possible to set it for EUR ?

Could you help me, what to set where ?

Thanks

Answer

mdahlman picture mdahlman · Apr 6, 2012

If you hard-code the format to use comma for the thousands separator, it's not possible that iReport would ignore this. It sounds like you have not done what you think.

But it seems likely that you need to set the JasperReports Server to use a different locale. You could edit this file:

WEB-INF/applicationContext-security.xml

You'll find the locale section. Add what you need for Slovakia. Then you can choose this locale on the login page.

Or it might be helpful to set the locale in Tomcat's startup script (or whatever app server you are using). These Java parameters might solve your problem (of course you won't want en_US... but those are the parameters):

java -Duser.language=en -Duser.region=US