Jasper reports 如何设置Jasper使用XSSF?

Jasper reports 如何设置Jasper使用XSSF?,jasper-reports,apache-poi,xssf,hssf,Jasper Reports,Apache Poi,Xssf,Hssf,在现有系统中,已使用jasper 5.0,并且据我所知,该系统使用poiHSSF生成xls数据,但随着应用程序的发展,报表在生成大量事务时出现问题 我已经搜索了解决方案,并使用XSSF找到了POI。因为jasper也使用POI HSSF,所以我考虑在jasper内部使用XSSF 可能吗?我怎么能做到呢?我需要使用jasper,因为现在无法更改现有的应用程序。要导出jrxml,请生成ooxmlXSSF,excel文件xlxs 使用net.sf.jasperreports.engine.export

在现有系统中,已使用jasper 5.0,并且据我所知,该系统使用poiHSSF生成xls数据,但随着应用程序的发展,报表在生成大量事务时出现问题

我已经搜索了解决方案,并使用XSSF找到了POI。因为jasper也使用POI HSSF,所以我考虑在jasper内部使用XSSF


可能吗?我怎么能做到呢?我需要使用jasper,因为现在无法更改现有的应用程序。

要导出jrxml,请生成ooxml
XSSF
,excel文件xlxs

使用
net.sf.jasperreports.engine.export.ooxml.jrxlsxporter

例如:

JasperPrint jasperPrint = JasperFillManager.fillReport(report, paramMap, connection); //Example of how to get the jasper print

JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
File outputFile = new File("excelTest.xlsx");
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputFile));
SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); 
configuration.setOnePagePerSheet(false); //Set configuration as you like it!!
configuration.setDetectCellType(true);
configuration.setCollapseRowSpan(false);
exporter.setConfiguration(configuration);
exporter.exportReport();
当然,在类路径中需要相关的库(poi-ooxml.jar、poi-ooxml-schemas.jar、xmlbeans.jar),它们出现在jasper report的发行版中

JRXlsxExporter的
JRXlsxExporter
从4.5版开始提供,这是最新版本。在版本4中,如果设置了参数而不是属性,请参见