如何更改JasperReports使用的语言环境? [英] How do I change the locale that JasperReports uses?
问题描述
我机器上安装的窗口具有区域设置 en_AU
,这就是JasperReports使用的内容。我已经尝试更改所有用户的语言环境,包括管理员,但它仍然使用 en_AU
。
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
.
我该怎么办?改变那个地区?是否可以在报告中更改 REPORT_LOCALE
参数?
How can I change that locale? Is it possible to change the REPORT_LOCALE
parameter on my report?
推荐答案
语言环境在执行期间设置,而不是在JRXML中设置。
The locale is set during execution, not in the JRXML.
使用Java,为报告设置 REPORT_LOCALE
参数参数图。例如:
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 );
使用Jaspersoft Studio,打开报告执行区域的项目属性对话框:
Using Jaspersoft Studio, open the project properties dialog to the Report Execution area:
使用iReport,在选项中设置报告区域设置常规选项卡中报告执行选项部分下的窗口。这将在运行时设置报告区域设置。
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.
这篇关于如何更改JasperReports使用的语言环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!