Fix from bug #45676 - Handle very long cells in the XSSF EventUserModel example

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@694949 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-09-13 14:00:53 +00:00
parent 633a9cf563
commit 0db7da83b7
4 changed files with 22 additions and 10 deletions

View 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>

View 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);
}
}

View 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>

View 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);
}
}