在Jasperserver中导出为CSV时,禁止所有子报表

时间:2014-02-05 08:30:48

标签: csv jasper-reports export jasperserver

对于CSV导出,我只希望数据显示而不是其他

我在jasperreports.properties文件中设置了这些参数

net.sf.jasperreports.export.csv.exclude.origin.band.1=pageHeader
net.sf.jasperreports.export.csv.exclude.origin.band.2=columnHeader
net.sf.jasperreports.export.csv.exclude.origin.band.3=columnFooter
net.sf.jasperreports.export.csv.exclude.origin.band.4=pageFooter
net.sf.jasperreports.export.csv.exclude.origin.band.5=summary

但有些页眉和页脚仍在显示。

在下面的图片中,我想在导出为CSV和NOTHING时显示的内容,但红色框(子报告)仍显示。

页面和列标题中的其他信息(不在红色或绿色框中)被排除在我想要的

之外

MyReport

那么总结一下,如何通过在导出到CSV时隐藏特定的子报告来获取要显示的详细信息行?

1 个答案:

答案 0 :(得分:0)

在.jrxml文件中使用这样的代码

<!-- Hides the Header Subreport when exporting to CSV -->
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.report.1" value="HeaderPortrait"/>
<!-- Hides all fields in pageHeader except subreports when exporting to CSV -->
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.2" value="pageHeader"/>
<!-- Hides the Footer Subreport when exporting to CSV -->
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.3" value="pageFooter"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.report.3" value="FooterPortrait"/>
<!-- Hides the saerbi017sub001 Subreport when exporting to CSV -->
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.4" value="pageHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.4" value="noData"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.report.4" value="saerbi017sub001"/>
<!-- Stops fields in columnHeader to display more than once when exporting to CSV  -->
<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.5" value="columnHeader"/>
<!-- Hides the Summary Subreport when exporting to CSV -->
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.6" value="summary"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.report.6" value="Summary"/>