Jaspersoft Excel 列问题
Jasper Soft Excel Column issues
我有 8 个子报告放在一个主报告上
"print.one .page.per.sheet" 启用。
并在每个子报告 net.sf.jasperreports.export.xls.break.after.row 属性 启用后(用于在新工作中打印每个子报告 sheet)
在将每个报告分别导出到 excel 时,excel sheet 中的每一列都与报告的列相匹配。
但是在将它放在主报告中后 excel 列与报告列重叠。
如何解决这个问题?
excel 将各个子报告放在不同工作表中的一种解决方案是不使用主报告,而是将不同子报告的 JasperPrint 作为不同工作表传递。
例子
List<JasperPrint> sheets = new ArrayList<JasperPrint>();
for (int i=1;i<=8;i++){
JasperPrint print = JasperFillManager.fillReport("subReport_" + i + ".jasper", paramMap, connection);
sheets.add(print);
}
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(sheets));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(new File("text.xlxs"));
SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
configuration.setSheetNames(sheetNames): //sheets names is an array of the different names.
configuration.setDetectCellType(true);
configuration.setWhitePageBackground(false);
configuration.setRemoveEmptySpaceBetweenColumns(true);
configuration.setRemoveEmptySpaceBetweenRows(true);
exporter.setConfiguration(configuration);
exporter.exportReport();
我有 8 个子报告放在一个主报告上 "print.one .page.per.sheet" 启用。 并在每个子报告 net.sf.jasperreports.export.xls.break.after.row 属性 启用后(用于在新工作中打印每个子报告 sheet) 在将每个报告分别导出到 excel 时,excel sheet 中的每一列都与报告的列相匹配。 但是在将它放在主报告中后 excel 列与报告列重叠。 如何解决这个问题?
excel 将各个子报告放在不同工作表中的一种解决方案是不使用主报告,而是将不同子报告的 JasperPrint 作为不同工作表传递。
例子
List<JasperPrint> sheets = new ArrayList<JasperPrint>();
for (int i=1;i<=8;i++){
JasperPrint print = JasperFillManager.fillReport("subReport_" + i + ".jasper", paramMap, connection);
sheets.add(print);
}
JRXlsxExporter exporter = new JRXlsxExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(sheets));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(new File("text.xlxs"));
SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
configuration.setSheetNames(sheetNames): //sheets names is an array of the different names.
configuration.setDetectCellType(true);
configuration.setWhitePageBackground(false);
configuration.setRemoveEmptySpaceBetweenColumns(true);
configuration.setRemoveEmptySpaceBetweenRows(true);
exporter.setConfiguration(configuration);
exporter.exportReport();