|Summary:||The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook Issue|
|Product:||POI||Reporter:||Ashok Mahendran <ashok.mahendran>|
|Component:||XSSF||Assignee:||POI Developers List <dev>|
Description Ashok Mahendran 2019-07-26 14:44:30 UTC
I have tried to export large number of data . I am using 3.15 Version applying style to cells like Text, Date, Number. Throwing below error 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:789) at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:715) at org.apache.poi.xssf.streaming.SXSSFWorkbook.createCellStyle(SXSSFWorkbook.java:868)
Comment 1 PJ Fanning 2019-07-26 17:10:25 UTC
POI 3.15 is no longer maintained. Could you try POI 4.1.0? Could you provide a test case if this issue appears in POI 4.1.0 too?
Comment 2 Dominik Stadler 2019-07-27 09:42:15 UTC
I think this is "as expected". Microsoft Excel limits the number of styles in Excel files and thus POI also limits them. The Exception tells you that you try to create more styles than possible. Usually this indicates incorrect usage of the API. You need to re-use styles and not create fresh ones for each and every cell, then also performance in both Apache POI and Excel itself may be better as much less styles need to be handled when opening/saving the file.