If you are designing a columnar report intended to be exported as Excel, here are some tips.
Design
Move the column titles to the Title band. This will allow it to appear only once in the report and not in every page.
Retain only the Title and Detail bands. Delete all other bands.
In the Title band, have only the report title and the column header in two rows. There is a property below that tells Excel to freeze the top 2 rows so that the title row and the column headers row is frozen so the user can scroll through thousands of records and still see them.
In the Detail band properties, set the following:
- Layout: "Grid" or "Spreadsheet". This forces the columns to be right beside each other.
- Height: 14 px
Properties for Excel Export
In the Source tab, insert the following lines below the other properties. These are selected properties recommended by this article.
<property name="net.sf.jasperreports.export.xls.wrap.text" value="false"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="false"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.export.xls.ignore.graphics" value="false"/>
<property name="net.sf.jasperreports.page.break.no.pagination" value="apply"/>
<property name="net.sf.jasperreports.export.xls.freeze.row" value="3"/>
<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
Top comments (0)