Return-Path: X-Original-To: apmail-poi-dev-archive@www.apache.org Delivered-To: apmail-poi-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3AECF107E1 for ; Fri, 2 May 2014 12:34:41 +0000 (UTC) Received: (qmail 52711 invoked by uid 500); 2 May 2014 12:34:40 -0000 Delivered-To: apmail-poi-dev-archive@poi.apache.org Received: (qmail 52415 invoked by uid 500); 2 May 2014 12:34:31 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 52407 invoked by uid 99); 2 May 2014 12:34:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 May 2014 12:34:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 May 2014 12:34:28 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 57F541B954; Fri, 2 May 2014 12:34:05 +0000 (UTC) From: bugzilla@apache.org To: dev@poi.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 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: HSSF X-Bugzilla-Version: 3.10 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: paucoma@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=56482 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 exception. 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 XLS](http://www.filedropper.com/mcfrsaxls) [Multi-Conditional-Formatting Rules saved as New Excel Format XLSX](http://www.filedropper.com/mcfrsaxlsx) --- In [this blog post from excel support group](http://office.microsoft.com/en-us/excel-help/create-flexible-effective-conditional-formats-in-excel-2007-HA010217629.aspx) 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 class](http://poi.apache.org/apidocs/org/apache/poi/hssf/record/aggregates/CFRecordsAggregate.html) 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.record.aggregates.CFRecordsAggregate.(CFRecordsAggregate.java:58) at org.apache.poi.hssf.record.aggregates.CFRecordsAggregate.createCFAggregate(CFRecordsAggregate.java:95) at org.apache.poi.hssf.record.aggregates.ConditionalFormattingTable.(ConditionalFormattingTable.java:49) at org.apache.poi.hssf.model.InternalSheet.(InternalSheet.java:143) at org.apache.poi.hssf.model.InternalSheet.createSheet(InternalSheet.java:121) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:311) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:264) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:199) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:342) at org.apache.poi.hssf.usermodel.HSSFWorkbook.(HSSFWorkbook.java:323) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:76) -- 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