poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 56482] New: Excel 2010 format workbook saved as 2003 format with more than three Conditional Formatting Rules per record causes java.lang.IllegalArgumentException
Date Fri, 02 May 2014 12:34:04 GMT

            Bug ID: 56482
           Summary: Excel 2010 format workbook saved as 2003 format with
                    more than three Conditional Formatting Rules per
                    record causes java.lang.IllegalArgumentException
           Product: POI
           Version: 3.10
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: paucoma@gmail.com

Created attachment 31587
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31587&action=edit
Multi-Conditional-Formatting Rules saved as Old Excel Format

It is possible to **create a file in Excel 2007, Excel 2010, LibreOffice Calc,
etc... with more than 3 conditional formatting rules per cell** and then **Save
it in the Excel 2003 format** , preserving those defined rules.

When POI detects the pre 2007 Excel format, it opens it with HSSFWorkbook and
all the rest... and when it bumps into more than 3 rules defined it throws an

If this same file is opened in LibreOffice for example and saved in 2007/2010
format and then opened again with the workbookFactory it creates an
XSSFWorkbook and everything works ok.


** Example Files **

[Multi-Conditional-Formatting Rules saved as Old Excel Format
[Multi-Conditional-Formatting Rules saved as New Excel Format


In [this blog post from excel support
It states: 

  > In previous versions of Excel, you could have a maximum of three
conditional formats. There's no such limit in Office Excel 2007; you may have
as many conditional formats as you like.

  - Because **pre-2007/2010** Excel files were limited to 3 rules, the library
object is also limited to 3. The [CFRecordsAggregate
states in its description:

  > CFRecordsAggregate - aggregates Conditional Formatting records
CFHeaderRecord and number of **up to three CFRuleRecord records** together to
simplify access to them.


Exception output:

java.lang.IllegalArgumentException: No more than 3 rules may be specified
    at org.apache.poi.hssf.model.InternalSheet.<init>(InternalSheet.java:143)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:311)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:264)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:199)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:342)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:323)

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message