Bug 58005 - Amount of CellStyles is still limited to 32K
Summary: Amount of CellStyles is still limited to 32K
Status: RESOLVED DUPLICATE of bug 58260
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.12-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on: 57880
Blocks: 58260
  Show dependency tree
Reported: 2015-06-05 13:24 UTC by Michael
Modified: 2015-08-19 13:42 UTC (History)
0 users

java code (1.67 KB, text/x-java)
2015-06-05 13:24 UTC, Michael
Resulting xlsx file (348.87 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2015-06-05 13:24 UTC, Michael

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2015-06-05 13:24:01 UTC
Created attachment 32796 [details]
java code

Amount of CellStyles is still limited to 32K. When you create large enough excel file, after reaching value of 32767 of CellStyles, next CellStyleID becomes negative (-32768).
Related bug # 57880 - for version 3.11 final. And it has not been fixed in the version 3.12 final, despite it is written in the release notes.
See attached java code and resulting xlsx file (what happens from the row 10923).

Same limit applies to Fonts.

PS: increasing limit to 64K is not a solution! Styles are stored in the ArrayList, and max size of it is MAX_INTEGER, which is 2,147,483,647
Comment 1 Michael 2015-06-05 13:24:44 UTC
Created attachment 32797 [details]
Resulting xlsx file
Comment 2 Dominik Stadler 2015-08-19 13:42:42 UTC
FYI, the general case up to 64k styles is fixed via bug 58260 now, it is not possible to support more than 64k of these because Excel itself limits the number of styles, files with more will be reported as corrupt by Excel! 

Also note the comments about proper re-using of styles in bug 58260, due to this usually not makes sense to have so many Fonts/Styles in the first place as you should re-use the created objects as much as possible!

I am closing this as DUPLICATE for now, please try with an upcoming nightly build or version 3.13-beta2 as soon as it becomes available and reopen the bug if this is still a problem for you.

*** This bug has been marked as a duplicate of bug 58260 ***