Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Export fails on large xlsx exports with too many styles used #39

Open
a-schild opened this issue Jul 3, 2018 · 0 comments
Open

Export fails on large xlsx exports with too many styles used #39

a-schild opened this issue Jul 3, 2018 · 0 comments

Comments

@a-schild
Copy link

a-schild commented Jul 3, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant