【发布时间】:2018-08-22 14:53:56
【问题描述】:
我正在尝试使用 PrimeFaces DataExporter 导出 xlsxstream 类型的文件,但我似乎收到此错误:
WARNING: Could not auto-size column. Make sure the column was tracked prior to auto-sizing the column.
java.lang.IllegalStateException: Could not auto-size column. Make sure the column was tracked prior to auto-sizing the column.
at org.apache.poi.xssf.streaming.SXSSFSheet.autoSizeColumn(SXSSFSheet.java:1606)
at org.apache.poi.xssf.streaming.SXSSFSheet.autoSizeColumn(SXSSFSheet.java:1560)
at org.primefaces.component.export.ExcelExporter.export(ExcelExporter.java:85)
at org.primefaces.component.export.DataExporter.processAction(DataExporter.java:145)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
...
知道如何调试这个问题,或者可能是什么原因?
【问题讨论】:
-
这感觉像是 XLSX 的 PF 实现中的一个错误。我会在 GitHub 问题页面上报告您的示例 XHTML sn-p 和此异常。
-
不,没有'sn-ps'...完整的minimal reproducible example....和版本信息
-
看起来可以修复:stackoverflow.com/questions/14497082/…。但我认为这必须在 PF 代码中修复。但是,您可以尝试确保您的 col/row 值都不为 NULL,而是将它们设为空字符串“”。
-
似乎用 'xslx' 替换 'xlsxstream' 在这里为我提供了快速修复
-
这是一个快速解决方案,但只要您同意,您的应用程序现在将使用更多内存来生成您的 XLSX。我想我会报告并修复 Primefaces 中的这个错误。
标签: jsf primefaces apache-poi