导出 excel 超过 256 列的 primefaces

Export excel with more than 256 columns with primefaces

我正在使用名为 dataExporterprimefaces 组件将数据导出到 xls 文件中。我的问题是导出的 excel 中不能超过 256 列,因为出现此错误:

java.lang.IllegalArgumentException: Invalid column index (256).  Allowable column range for BIFF8 is (0..255) or ('A'..'IV')

我调查了一下,发现 this - 所以我的错误似乎是因为 dataExporter 可能使用 org.apache.poi.hssf.usermodel 而不是更新的 org.apache.poi.xssf.usermodel。我可以告诉这个 primefaces 组件使用不同的实现吗?或者也许我可以使用不同的 primefaces 组件?有什么想法吗?

我的问题的解决方案确实如@BackSlash 和@Melloware 在他们的评论中所建议的那样

  1. 将我的 primefaces 版本升级到 6.0
  2. 为导出器使用 xlsxstream 类型

    <p:dataExporter type="xlsxstream" target="my-table" fileName="my-file" />

稍后编辑:xlsx 类型可能也是一个不错的选择,请参阅 以了解 xlsxxlsxstream

之间的比较