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
1.2k views
in Technique[技术] by (71.8m points)

jasper reports - Setting REPORT_LOCALE in IReport?

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

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

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); 

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

...