I'm using Apache POI (https://poi.apache.org/) and I notice the following message when I create an excel spreadsheet :
java.lang.IllegalStateException: The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook
This is appearing at warning level and the excel spreadsheet generated seems correct. What is the impact on Excel generation when this exception is thrown?
Referring to this question java.lang.IllegalStateException: The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook suggests the spreadsheet is not created when this exception is thrown, but I have not observed this behavior.
CodePudding user response:
Depending on the client opening the generated file, it might be impossible to open the file or impossible to save changes to the opened file.
To prevent this you should create cell styles only once, maintain a reference to the style, and apply the same style to multiple cells, which should have the same style. Instead of creating multiple styles with the same configuration for multiple cells. There is no duplication detection in place that would prevent you from creating multiple styles with the same configuration or reusing them in the background.