-
New Feature
-
Resolution: Fixed
-
Normal
-
3.5.0
-
Security Level: Jimmy
Currently, AbstractExcelImporter determines whether a POI cell style is duplicated or not by cell style's index. But we found some styles with different indexes have identical content (see attached Excel file). 3.5 importer cannot reduce style count for such kind of Excel file. The attached Excel file provided by customers is created by continuously editing and adding sheets in the same file in 2.6 ZSS. Its style object count already exceeds Excel file upper limit according to specification. So open the file with Excel will prompt users to recover it.
Excel specification and limits
2003: http://office.microsoft.com/en-001/excel-help/excel-specifications-and-limits-HP005199291.aspx
2007: http://office.microsoft.com/en-001/excel-help/excel-specifications-and-limits-HP010073849.aspx?CTT=1
If an importer can compare incoming style and imported style with their content, when two styles content are identical, it reuses previously imported style object without creating new one.
Notes for Implementation:
I found XSSFCellStyle and HSSFCellStyle both implement equal() and hash(). Just change current importedStyle key with CellStyle can make this work. (see ReduceRedundantStyleImporter.java)