如果您使用的不是JasperReports的旧版本,则使用不推荐使用的方法,最重要的是,您不会将其传递
JasperPrint给导出器。
没有输入源提供给出口商。
您需要 填写报告 ,使用
JasperFillManager.fillReport
示例代码(碧玉报告v5或更高版本)
JasperDesign jasperDesign = JRXmlLoader.load(new FileInputStream(reportFile));JasperPrint jasperPrint = JasperFillManager.fillReport(jasperDesign, parameters, conn);JRXlsExporter exporter = new JRXlsExporter();exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); //The JasperPrint, filled reportexporter.setExporterOutput(new SimpleOutputStreamExporterOutput(xlsReport)); //Your ByteArrayOutputStreamSimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();configuration.setonePagePerSheet(true);configuration.setDetectCellType(true);configuration.set //The other properties you like to setexporter.setConfiguration(configuration);exporter.exportReport();



