You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2010/01/06 18:49:51 UTC

DO NOT REPLY [Bug 48494] New: EventBasedExcelExtractor and ExcelExtractor don't process conditional cell formatting correctly

https://issues.apache.org/bugzilla/show_bug.cgi?id=48494

           Summary: EventBasedExcelExtractor and ExcelExtractor don't
                    process conditional cell formatting correctly
           Product: POI
           Version: 3.6
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: philvarner@gmail.com


Created an attachment (id=24803)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24803)
sheet that exhibits issue

>> The EBEE tries to format decimal values before returning them using
>> the method formatNumberDateCell.  I have some xls (unfortunately I
>> can't share) that throw an exception from the DecimalFormat
>> constructor:
>> java.lang.IllegalArgumentException: Unquoted special character ';' in
>> pattern "_(*#,##0_);_(*(#,##0);_(* "-"_);_(@_)"


UserModel copes, but because no formatting is applied. Relevant code
in ExcelExtractor:

case HSSFCell.CELL_TYPE_NUMERIC:
 // Note - we don't apply any formatting!
 text.append(cell.getNumericCellValue());
 break;

However, a date formatted cell (string cell type) with
"hh:mm;hh:mm;hh:mm" fails in both.

I believe this means conditional cell formatting never works (either
not being applied or throwing exception), only static cell formatting.
 I'm not sure what the above format of the 3- or 4-valued conditional
is, though.

I'll file a bug for this. Attached is a doc that exhibits the issue
and a java class that reproduces.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 48494] EventBasedExcelExtractor and ExcelExtractor don't process conditional cell formatting correctly

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48494

--- Comment #4 from Nick Burch <ni...@alfresco.com> 2010-06-02 13:18:16 EDT ---
Also, your time formats like HH:MM;HH:MM;HH:MM are also detected as times now
too.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 48494] EventBasedExcelExtractor and ExcelExtractor don't process conditional cell formatting correctly

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48494

--- Comment #1 from Phil Varner <ph...@gmail.com> 2010-01-06 09:50:55 UTC ---
Created an attachment (id=24804)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24804)
runs EBEE and EE on xls

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 48494] EventBasedExcelExtractor and ExcelExtractor don't process conditional cell formatting correctly

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48494

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Nick Burch <ni...@alfresco.com> 2010-06-02 12:13:53 EDT ---
Fixed in r950616.

We already had a reference to the usermodel style DataFormatter, we just
weren't using it, doh! Now changed to call the normal DataFormatter, so the
event based extractor should behave more like the usermodel one does

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 48494] EventBasedExcelExtractor and ExcelExtractor don't process conditional cell formatting correctly

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48494

--- Comment #2 from Phil Varner <ph...@gmail.com> 2010-03-05 06:06:13 UTC ---
Patch (the revision commit numbers may need removing/changing, this was to a
private svn repo):

Index: src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java
===================================================================
--- src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java       
(revision 99199)
+++ src/java/org/apache/poi/hssf/extractor/EventBasedExcelExtractor.java       
(revision 99174)
@@ -275,15 +275,8 @@
                        }

                        // Format as a number
-                       // some format strings contain unescaped ;s which cause
-                       // problems.  Since this is only for indexing, we
-                       // can ignore these and just return the unformatted
string (hacky?)
-                       try {
-                               DecimalFormat df = new
DecimalFormat(formatString);
-                               return df.format(value);
-                       } catch (java.lang.IllegalArgumentException e){
-                               return String.valueOf(value);
-                       }
+                       DecimalFormat df = new DecimalFormat(formatString);
+                       return df.format(value);
                }
        }
 }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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