我使用JRXlsxExporter导出xlsx报告,下面是java端代码,
JRXlsxExporter xlsExporter = new JRXlsxExporter();
AbstractXlsReportConfiguration config = new SimpleXlsxReportConfiguration();
config.setOnePagePerSheet(false);
config.setDetectCellType(Boolean.TRUE);
config.setRemoveEmptySpaceBetweenRows(true);
config.setCollapseRowSpan(Boolean.TRUE);
config.setIgnoreGraphics(Boolean.TRUE);
config.setWrapText(Boolean.TRUE);
config.setColumnWidthRatio(2.0F);
config.setShowGridLines(Boolean.FALSE);
config.setRemoveEmptySpaceBetweenColumns(Boolean.TRUE);
config.setFontSizeFixEnabled(false);
config.setSheetNames(new String[]{"Sheet1"});
List<ExporterInputItem> items = new ArrayList<>();
items.add(new SimpleExporterInputItem(jPrint, config));
xlsExporter.setExporterInput(new SimpleExporterInput(items));
xlsExporter.setExporterOutput(new SimpleOutputStreamExporterOutput(path));
xlsExporter.exportReport();
但是当我打开生成的xlsx文件时,它看起来像这样。
xlsx没有为那些超过2行的单元格正确显示文本。
任何帮助都会很棒。