Andrei Statescu
Andrei Statescu

Reputation: 329

Export excel with more than 256 columns with primefaces

I'm using a primefaces component called dataExporter to export data into an xls file. My problem is that I cannot have more than 256 columns in the exported excel because I get this error:

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

I investigated a bit, and found this - so it seems my error comes from the fact that the dataExporter might use org.apache.poi.hssf.usermodel instead of the newer org.apache.poi.xssf.usermodel. Can I tell this primefaces component to use a different implementation? Or maybe I can use a different primefaces component? Any idea?

Upvotes: 1

Views: 1285

Answers (1)

Andrei Statescu
Andrei Statescu

Reputation: 329

The solution for my problem was indeed as suggested by @BackSlash and @Melloware in their comments

  1. Upgrade my version of primefaces to 6.0
  2. Use the xlsxstream type for the Exporter

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

Later Edit: the xlsx type might have been a good choice also, see this question for a comparison between xlsx and xlsxstream

Upvotes: 1

Related Questions