JRXlsxExporter:单元格中的值无法正确显示

时间:2016-11-14 09:10:49

标签: java jasper-reports export-to-excel

我使用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文件时,它看起来像这样。 enter image description here

xlsx没有为那些超过2行的单元格正确显示文本。

任何帮助都会很棒。

0 个答案:

没有答案