I have a Jasper Report which seems to be exporting fine in all formats except Excel.
The below sample is of a column that should be formatted as currency but shows incorrectly.
Here are the jasper properties i'm using...
out = new FileOutputStream(file);
JExcelApiExporter exporterXLS = new JExcelApiExporter();
exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, print);
exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
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.CREATE_CUSTOM_PALETTE, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER, Boolean.TRUE);
exporterXLS.setParameter(JRXlsExporterParameter.IS_IGNORE_GRAPHICS, Boolean.FALSE);
exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, out);
exporterXLS.exportReport();
I've tried both Jasper 4.0 and 4.5. I think it has to do with a dependency but i'm not sure.
fixed!
Instead of using the
JRXlsExporterParameter
class i used the parameters as follows and it worked!You can try to add
net.sf.jasperreports.export.xls.pattern
property for yourtextField
element in jrxml file.You can find the sample here.