2015-11-22 60 views
1

我正在使用iReport 5.6来设计报告。
有什么办法可以在页面底部打印报告路径。
我试着用buit-in参数。但我其实不知道该怎么做。

我想展示的例子;
BaseDir: http://localhost:8080/MyReports
ReportFile: http://localhost:8080/MyReports/myreport.jasper贾斯珀报告打印报告路径页

谢谢你,
Supun

回答

1

传递参数的报告应该在这里服务宗旨。

String reportFileName = "your jasper path"; 
... 
Map jasperParameters = new HashMap(); 
parameters.put("reportFilePath",reportFileName); 

在JRXML,你会做到以下几点。

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" 
...> 
<parameter name="reportFilePath" class="java.lang.String"/> 
... 
<textFieldExpression class="java.lang.String"> 
      <![CDATA[$P{reportFilePath}]]> 
</textFieldExpression> 

您可以参考this示例使用参数。