This repository was archived by the owner on Jul 29, 2022. It is now read-only.

Description
Generating xlsx files with more than 64000 cells fails with this error message
ERROR org.vaadin.addons.excelexporter.ExportToExcel - addGenericDataRow throws + The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook
java.lang.IllegalStateException: The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook
at org.apache.poi.xssf.model.StylesTable.createCellStyle(StylesTable.java:815)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:730)
at org.vaadin.addons.excelexporter.configuration.ExportExcelComponentConfiguration.lambda$new$2(ExportExcelComponentConfiguration.java:98)
at org.vaadin.addons.excelexporter.ExportToExcel.addGridDataRow(ExportToExcel.java:405)
at org.vaadin.addons.excelexporter.ExportToExcel.addGridContent(ExportToExcel.java:248)
at org.vaadin.addons.excelexporter.ExportToExcel.addGridToExcelSheet(ExportToExcel.java:231)
at org.vaadin.addons.excelexporter.ExportToExcel.addGridToExcelSheet(ExportToExcel.java:197)
at org.vaadin.addons.excelexporter.ExportToExcel.addComponents(ExportToExcel.java:124)
at org.vaadin.addons.excelexporter.ExportToExcel.process(ExportToExcel.java:115)
at org.vaadin.addons.excelexporter.ExportToExcel.(ExportToExcel.java:91)
The problem is, that in the DataCellStyleGeneratorFunction a new style is defined for the alternating background color.
In excel sheet (xls and xlsx) it's important to reuse styles as much as possible, since they are limited to ~4000 in xls files, and 64'000 in xlsx files.