XLS Export Parameters in JasperReports Server

Table of Contents 

XLS Export Parameters

JasperReports Server is shipped with a default configuration that produces a data-centric Excel output where graphic elements are ignored, spacer cells are removed and the data type of cells is preserved.

Property Name Default Description
detectCellType true Preserve the type of the original text field expressions and use it for the cell data type
onePagePerSheet false Each report page should be written in a different XLS sheet
removeEmptySpaceBetweenRows true Empty spaces that could appear between rows should be removed or not.
removeEmptySpaceBetweenColumns true Empty spaces that could appear between columns should be removed or not.
whitePageBackground false Force cell white background
ignoreGraphics true Export text elements only
collapseRowSpan true Collapse row span and avoid merging cells across rows
ignoreCellBorder true Do not draw the cell border
fontSizeFixEnabled true Decrease font size so that texts fit into the specified cell height
maximumRowsPerSheet 0 Maximum number of rows allowed before continuing on a new sheet

In report templates, Java specific format patterns are used to format dates and numbers (see JasperReports documentation for details). But these patterns might not work inside the Excel document viewer program, as their syntax might not be fully supported there.

In such cases, the Java format patterns have to be converted to equivalent proprietary format patterns using the formatPatternsMap bean inside the WEB-IN/applicationContext.xml file, where pairs of equivalent patterns can be added.

How the various XLS exporting properties are structured in the the WEB-IN/applicationContext.xml file:

<bean ...="" id="xlsExportParameters">
    <property name="detectCellType" value="true" />
    <property name="onePagePerSheet" value="false" />
    <property name="removeEmptySpaceBetweenRows" value="true" />
    <property name="removeEmptySpaceBetweenColumns" value="true" />
    <property name="whitePageBackground" value="false" />
    <property name="ignoreGraphics" value="true" />
    <property name="collapseRowSpan" value="true" />
    <property name="ignoreCellBorder" value="true" />
    <property name="fontSizeFixEnabled" value="true" />
    <property name="maximumRowsPerSheet" value="0" />
    <property name="xlsFormatPatternsMap" ref="formatPatternsMap" />
</bean>
<util:map id="formatPatternsMap">
    <!-- entry key="¤ #,##0.00" value="$ #,##0.00"/ -->
</util:map>

See Also:

Feedback