Reputation: 249
I'm working on jasper reports and the .xlxs file that gets generated from the jasper gives this error We found a problem with some content in 'DetailedQuoteReport ISX003178-001.xlsx. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes. However the PDF, word, .xls file are getting generated and opened fine. I'm unable to rectify the cause. The code in order to generate the excel is below
public ByteArrayOutputStream export(JasperPrint jp) {
Exporter exporter =exporter = new JRXlsxExporter();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
// Here we assign the parameters jp and baos to the exporter
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
if (ReportOutputType.XLS.equals(reportOutputType) || ReportOutputType.XLSX.equals(reportOutputType)) {
exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_GRAPHICS, Boolean.FALSE);
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_COLLAPSE_ROW_SPAN, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_FONT_SIZE_FIX_ENABLED, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER, Boolean.TRUE);
}
try {
exporter.exportReport();
} catch (JRException e) {
throw new RuntimeException(e);
}
return baos;
}
The jasper Version that I'm using is 6.17.0 , Dynamic jasper = 5.3.3 , poi = 5.2.0 , poi-ooxml ,ooxml-schemas - 1.4 . As soon as I click on yes in the excel popup the excel opens successfully but why the error prompt is coming? Please help
Upvotes: 0
Views: 379