Fix an off-by-one in the xssf eventmodel example and docs
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@644692 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c44e3a4b4a
commit
95756c5472
@ -542,10 +542,12 @@ public class ExampleEventUserModel {
|
|||||||
|
|
||||||
Iterator<InputStream> sheets = r.getSheetsData();
|
Iterator<InputStream> sheets = r.getSheetsData();
|
||||||
while(sheets.hasNext()) {
|
while(sheets.hasNext()) {
|
||||||
|
System.out.println("Processing new sheet:\n");
|
||||||
InputStream sheet = sheets.next();
|
InputStream sheet = sheets.next();
|
||||||
InputSource sheetSource = new InputSource(sheet);
|
InputSource sheetSource = new InputSource(sheet);
|
||||||
parser.parse(sheetSource);
|
parser.parse(sheetSource);
|
||||||
sheet.close();
|
sheet.close();
|
||||||
|
System.out.println("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,13 +580,19 @@ public class ExampleEventUserModel {
|
|||||||
// Print the cell reference
|
// Print the cell reference
|
||||||
System.out.print(attributes.getValue("r") + " - ");
|
System.out.print(attributes.getValue("r") + " - ");
|
||||||
// Figure out if the value is an index in the SST
|
// Figure out if the value is an index in the SST
|
||||||
if(attributes.getValue("t").equals("s")) {
|
String cellType = attributes.getValue("t");
|
||||||
|
if(cellType != null && cellType.equals("s")) {
|
||||||
nextIsString = true;
|
nextIsString = true;
|
||||||
} else {
|
} else {
|
||||||
nextIsString = false;
|
nextIsString = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endElement(String uri, String localName, String name)
|
||||||
|
throws SAXException {
|
||||||
// v => contents of a cell
|
// v => contents of a cell
|
||||||
|
// Output after we've seen the string contents
|
||||||
if(name.equals("v")) {
|
if(name.equals("v")) {
|
||||||
System.out.println(lastContents);
|
System.out.println(lastContents);
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,12 @@ public class FromHowTo {
|
|||||||
|
|
||||||
Iterator<InputStream> sheets = r.getSheetsData();
|
Iterator<InputStream> sheets = r.getSheetsData();
|
||||||
while(sheets.hasNext()) {
|
while(sheets.hasNext()) {
|
||||||
|
System.out.println("Processing new sheet:\n");
|
||||||
InputStream sheet = sheets.next();
|
InputStream sheet = sheets.next();
|
||||||
InputSource sheetSource = new InputSource(sheet);
|
InputSource sheetSource = new InputSource(sheet);
|
||||||
parser.parse(sheetSource);
|
parser.parse(sheetSource);
|
||||||
sheet.close();
|
sheet.close();
|
||||||
|
System.out.println("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,13 +96,19 @@ public class FromHowTo {
|
|||||||
// Print the cell reference
|
// Print the cell reference
|
||||||
System.out.print(attributes.getValue("r") + " - ");
|
System.out.print(attributes.getValue("r") + " - ");
|
||||||
// Figure out if the value is an index in the SST
|
// Figure out if the value is an index in the SST
|
||||||
if(attributes.getValue("t").equals("s")) {
|
String cellType = attributes.getValue("t");
|
||||||
|
if(cellType != null && cellType.equals("s")) {
|
||||||
nextIsString = true;
|
nextIsString = true;
|
||||||
} else {
|
} else {
|
||||||
nextIsString = false;
|
nextIsString = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endElement(String uri, String localName, String name)
|
||||||
|
throws SAXException {
|
||||||
// v => contents of a cell
|
// v => contents of a cell
|
||||||
|
// Output after we've seen the string contents
|
||||||
if(name.equals("v")) {
|
if(name.equals("v")) {
|
||||||
System.out.println(lastContents);
|
System.out.println(lastContents);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user