I am creating a xls jasper report and all the data is rendering correctly but the column headers do not show up in the report. The first row of the excel sheet is blank for all columns. Is there something I am doing wrong?
<detail>
<band height="60">
<componentElement>
<reportElement positionType="Float" x="0" y="29" width="555" height="29" isPrintWhenDetailOverflows="true"/>
<jr:table xmlns:jr="http://ift.tt/1cl9b3L" xsi:schemaLocation="http://ift.tt/1cl9b3L http://ift.tt/1cl9b3P" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="results">
<datasetParameter name="REPORT_DATA_SOURCE">
<datasetParameterExpression><![CDATA[$P{results}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
<jr:column width="100">
<jr:columnHeader height="10" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="100" height="10"/>
<text><![CDATA[Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="10" >
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="100" height="10"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{person}.getName()]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
Here is the java code
JRXlsExporter exporter = new JRXlsExporter();
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource);
exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_GRAPHICS, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, res.getOutputStream());
exporter.exportReport();
No comments:
Post a Comment