Cloumn Header repeated when report is exported to Excel

Hi,

We are facing problem of column header repeat in export in excel. We are using jasper 5.0.1 version.

 

Below are the parameters we are using while exporting the report in excel format. Sample report attached.

JRXlsExporter exporterXLS = new JRXlsExporter();
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);
exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, outStream);
exporterXLS.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BACKGROUND, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, -1);
 
exporterXLS.exportReport();
 
Your help will be really appreciated.
 
Thanks,
Pravin
Attachments: 
23.pravin's picture
Joined: Dec 19 2013 - 8:29pm
Last seen: 8 years 6 months ago

1 Answer:

Hi Pravin,

You can add below property in your jrxml file. This will show the column headers only for once.

For Column Headers:

<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader"/>

For Page Headers:

<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.2" value="pageHeader"/>

atmaling's picture
251
Joined: Aug 1 2007 - 10:19pm
Last seen: 8 months 2 weeks ago
Feedback
randomness