Created attachment 32710 [details] Java code When creating large excel file and creating more than 32,767 (MAX VALUE for short) cellStyles, POI writes into sheet1.xml file negative values for that index: next after 32,767 comes -32,768, then -32,767, -32,766, etc... This creates corrupted xlsx file.
Created attachment 32711 [details] template xlsx file
In r1677371 I've added fixes for data formats and cell styles > 32,767 in XSSF, along with a (slightly slow) unit test showing that things work fine If I've missed some bit of your use case in the unit test, and some part of the problem still remains, please re-open this bug and attach an updated unit test showing what remains
The xlsx file may be corrupted if you create too many data formats. Excel only supports between 200-250 data formats. See bug 58775.