Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
844 views
in Technique[技术] by (71.8m points)

jasper reports - 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?

question from:https://stackoverflow.com/questions/248350/how-do-i-change-the-locale-that-jasperreports-uses

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...