Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the locale that JasperReports uses?

The windows installed on my machine has the locale en_AU and that's what JasperReports uses. I already tried changing the locale of all users, including the Administrator but it still uses en_AU.

How can I change that locale? Is it possible to change the REPORT_LOCALE parameter on my report?

like image 251
Francisco Fiuza Avatar asked Oct 29 '08 20:10

Francisco Fiuza


People also ask

Where do I put JasperReports properties?

jasper. properties is looked up by jasper reports in the classpath, so it can be directly in the WEB-INF/classes folder, or in the root folder of any of the jars in WEB-INF/lib.

What language does jaspersoft use?

The default expression language is Java, but if you are not a programmer, we recommend that you design your projects with JavaScript or Groovy because those languages hide a lot of the Java complexity.

What is JasperReports server?

An introduction to JasperReports Server and its key capabilities. JasperReports Server is a stand-alone and embeddable reporting server, enabling delivery of mission critical information on a real-time or scheduled basis to the web, to the printer, or to a variety of file formats.


1 Answers

The locale is set during execution, not in the JRXML.

Using Java, set the REPORT_LOCALE parameter for the report's parameter map. For example:

InputStream reportTemplate = getReportTemplate(); JRDataSource dataSource = getDataSource();  java.util.Map parameters = getParameters(); java.util.Locale locale = new Locale( "en", "US" ); parameters.put( JRParameter.REPORT_LOCALE, locale );  JasperFillManager.fillReport( reportTemplate, parameters, dataSource ); 

Using Jaspersoft Studio, open the project properties dialog to the Report Execution area:

Project Properties

Using iReport, set the report locale in the Options window under the "Report execution options" section in the General tab. This will set the report locale when run.

like image 120
waxwing Avatar answered Sep 30 '22 00:09

waxwing