JRExporter在5.6中已弃用。他们引入了新的接口Exporter,并对所有的Exporter进行了改造,使其具有ExporterInput,ReportExportConfiguration,ExporterConfiguration,ExporterOutput。见下面的链接
http://jasperreports.sourceforge.net/api/net/sf/jasperreports/export/Exporter.html
这意味着您需要使用上述类或其子类PDF导出示例来创建配置,而不是setParameter。Excel导出应遵循相同的方法
JRPdfExporter exporter = new JRPdfExporter();exporter.setExporterInput(new SimpleExporterInput(jasperPrint));exporter.setExporterOutput(outputStream);SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();exporter.setConfiguration(configuration);exporter.exportReport();
Excel对应
JRXlsExporter exporter = new JRXlsExporter();exporter.setExporterInput(new SimpleExporterInput(jasperPrint));exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();configuration.setonePagePerSheet(true);configuration.setDetectCellType(true);configuration.setCollapseRowSpan(false);exporter.setConfiguration(configuration);exporter.exportReport();
SimpleXlsReportConfiguration将具有与excel导出相关的配置。根据您的要求设置值



