]> source.dussan.org Git - poi.git/commitdiff
Fix from bug #45676 - Handle very long cells in the XSSF EventUserModel example
authorNick Burch <nick@apache.org>
Sat, 13 Sep 2008 14:00:53 +0000 (14:00 +0000)
committerNick Burch <nick@apache.org>
Sat, 13 Sep 2008 14:00:53 +0000 (14:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@694949 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/spreadsheet/how-to.xml
src/documentation/content/xdocs/status.xml
src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java

index 6025906757e64bc1e0c14111427200544b39d27d..f07ad2f350673a716b44e0e4e7649c93b90c3c82 100644 (file)
@@ -41,6 +41,7 @@
         </release>
 -->
         <release version="3.5.1-beta2" date="2008-08-20">
+           <action dev="POI-DEVELOPERS" type="fix">45676 - Handle very long cells in the XSSF EventUserModel example</action>
            <action dev="POI-DEVELOPERS" type="add">Initial ExtractorFactory support for building TextExtractors for embeded documents</action>
            <action dev="POI-DEVELOPERS" type="add">Support stripping XSSF header and footer fields (eg page number) out of header and footer text if required</action>
            <action dev="POI-DEVELOPERS" type="add">Add POIXMLPropertiesTextExtractor, which provides to the OOXML file formats a similar function to HPSF's HPSFPropertiesExtractor</action>
index 970482cef965d9e51f3012b2c9e896c5e1692255..5d70b083458d12d226268514f91e42ced374aa72 100644 (file)
@@ -587,10 +587,19 @@ public class ExampleEventUserModel {
                                        nextIsString = false;
                                }
                        }
+                       // Clear contents cache
+                       lastContents = "";
                }
                
                public void endElement(String uri, String localName, String name)
                                throws SAXException {
+                       // Process the last contents as required.
+                       // Do now, as characters() may be called more than once
+                       if(nextIsString) {
+                               int idx = Integer.parseInt(lastContents);
+                               lastContents = sst.getSharedStringAt(idx);
+                       }
+
                        // v => contents of a cell
                        // Output after we've seen the string contents
                        if(name.equals("v")) {
@@ -600,11 +609,7 @@ public class ExampleEventUserModel {
 
                public void characters(char[] ch, int start, int length)
                                throws SAXException {
-                       lastContents = new String(ch, start, length);
-                       if(nextIsString) {
-                               int idx = Integer.parseInt(lastContents);
-                               lastContents = sst.getSharedStringAt(idx);
-                       }
+                       lastContents += new String(ch, start, length);
                }
        }
        
index 9eaab3dad1f9a206f2cbcdcc188786b8e3e93b2e..0adf13d18cbe1c2cfb43c622805f150b55f4390f 100644 (file)
@@ -38,6 +38,7 @@
         </release>
 -->
         <release version="3.5.1-beta2" date="2008-08-20">
+           <action dev="POI-DEVELOPERS" type="fix">45676 - Handle very long cells in the XSSF EventUserModel example</action>
            <action dev="POI-DEVELOPERS" type="add">Initial ExtractorFactory support for building TextExtractors for embeded documents</action>
            <action dev="POI-DEVELOPERS" type="add">Support stripping XSSF header and footer fields (eg page number) out of header and footer text if required</action>
            <action dev="POI-DEVELOPERS" type="add">Add POIXMLPropertiesTextExtractor, which provides to the OOXML file formats a similar function to HPSF's HPSFPropertiesExtractor</action>
index d2d78c0943cf7632751d767ef39f97fe6c336ad4..f298ee10f6bb4a54d4e9e3aeea0612658ac287f1 100644 (file)
@@ -103,10 +103,19 @@ public class FromHowTo {
                                        nextIsString = false;
                                }
                        }
+                       // Clear contents cache
+                       lastContents = "";
                }
                
                public void endElement(String uri, String localName, String name)
                                throws SAXException {
+                       // Process the last contents as required.
+                       // Do now, as characters() may be called more than once
+                       if(nextIsString) {
+                               int idx = Integer.parseInt(lastContents);
+                               lastContents = sst.getSharedStringAt(idx);
+                       }
+
                        // v => contents of a cell
                        // Output after we've seen the string contents
                        if(name.equals("v")) {
@@ -116,11 +125,7 @@ public class FromHowTo {
 
                public void characters(char[] ch, int start, int length)
                                throws SAXException {
-                       lastContents = new String(ch, start, length);
-                       if(nextIsString) {
-                               int idx = Integer.parseInt(lastContents);
-                               lastContents = sst.getSharedStringAt(idx);
-                       }
+                       lastContents += new String(ch, start, length);
                }
        }