Bug 57880

Summary: Writing negative cellStyleIndex into sheet1.xml
Product: POI Reporter: Michael <mshlayen>
Component: XSSFAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 3.11-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 57884, 58005    
Attachments: Java code
template xlsx file

Description Michael 2015-05-01 15:26:31 UTC
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.
Comment 1 Michael 2015-05-01 15:27:20 UTC
Created attachment 32711 [details]
template xlsx file
Comment 2 Nick Burch 2015-05-03 08:11:49 UTC
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
Comment 3 Javen O'Neal 2015-12-28 09:08:48 UTC
The xlsx file may be corrupted if you create too many data formats. Excel only supports between 200-250 data formats. See bug 58775.