我试图用+80.000导出一个XLS文件,我得到了“net.sf.jasperreports.engine.JRException:单元格无法添加”。导出带有+80.000记录的XLS
我试图超出“MAXIMUM_ROWS_PER_SHEET”,但它没有奏效。
这是我的代码:
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
JasperReport relatorioJasper = (JasperReport) JRLoader.loadObjectFromFile(parametros.get("REPORT_JASPER")+"");
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(listaReport);
JasperPrint jasperPrint = JasperFillManager.fillReport(relatorioJasper, parametros, dataSource);
JRXlsExporter exporter = new JRXlsExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(out));
SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
configuration.setOnePagePerSheet(false);
configuration.setDetectCellType(true);
configuration.setCollapseRowSpan(false);
configuration.setRemoveEmptySpaceBetweenColumns(true);
// exporter.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, 10000);
exporter.setConfiguration(configuration);
exporter.exportReport();
InputStream relatorios = new ByteArrayInputStream(out.toByteArray());
return stream2file(relatorios, parametros.get("REPORT_NAME")+"" ,Constantes.XLS);
}catch(Exception e){
e.printStackTrace();
}
return null;
任何人可以帮助我吗?
你可以发布完整的堆栈跟踪文章 –
@ user3633580你可以尝试使用附加的* JasperReports *库源代码来调试代码。您可以在新JRException(EXCEPTION_MESSAGE_KEY_CANNOT_ADD_CELL)引发的地方设置断点,例如在* JExcelApiExporter *类中,在这种情况下,您可以捕获异常的第三方库(POI或JExcelApi)的原因 –
感谢您的提示,但它只是改变XLS到XLSX – user3633580