Jasper Reports - Export to CSV includes multiple headers and footers

After a series of articles related to JasperReports, there's been a recurring issue reported by customers and contacts. When exporting to CSV the titles, footers, and/or the column headers are repeated across the document. Which basically defeats the ease of use for CSV files to load them into external systems, filter them or open them in Excel.

When building custom reports, the following properties can be added to the jrxml via JasperStudio or by exporting the report, modifying the files and uploading back via the UI (for more information on how to use properties refer to https://community.jaspersoft.com/wiki/properties-how-use-additional-properties-build-enhanced-reports):

<!--hide footers and headers, except for firt page -->
<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.2" value="pageFooter"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.band.3=" value="olumnHeader"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.keep.first.report.3" value="*"/>
<property name="net.sf.jasperreports.export.csv.exclude.origin.band.4" value="columnFooter"/>


Oscar Estrada

Clarity consultant at ITROI Solutions

6 年

It works great!! An easy and fast solution

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了