Setting REPORT_LOCALE in IReport?

2020-02-06 17:57发布

问题:

Is it possible to overwrite the Param REPORT_LOCALE via Scriptlet, or directly in IReports ?

Pseudocode:

 if($P{MYLOCALEPARAM}== 1) REPORT_LOCALE = "en_US";
    if($P{MYLOCALEPARAM}== 2) REPORT_LOCALE = "de_GE";
    ....

I start the reports via

"RunJasper.jar"
(gtwebmarque.com)

via PHP exec and i am loath to change and recompile this tool ...

I know that there are some localisation Options in IReport Options Tabs. But i would like to implement it dynamicly

BR Christian

回答1:

You can set locale with help of JasperReports API.

The sample:

Map params = new HashMap(); 
params.put(JRParameter.REPORT_LOCALE, Locale.US); 
JasperFillManager.fillReportToFile(compiledReportName, params);