<changes>
<release version="3.8-beta1" date="2010-??-??">
-
+ <action dev="poi-developers" type="fix">50119 - avoid NPE when XSSFReader comes across chart sheets</action>
</release>
<release version="3.7" date="2010-10-25">
<action dev="poi-developers" type="fix">50075 - avoid NPE in ListLevel.getNumberText() when numberText is null </action>
//step 1. Map sheet's relationship Id and the corresponding PackagePart
sheetMap = new HashMap<String, PackagePart>();
for(PackageRelationship rel : wb.getRelationships()){
- if(rel.getRelationshipType().equals(XSSFRelation.WORKSHEET.getRelation())){
+ if(rel.getRelationshipType().equals(XSSFRelation.WORKSHEET.getRelation()) ||
+ rel.getRelationshipType().equals(XSSFRelation.CHARTSHEET.getRelation())){
PackagePartName relName = PackagingURIHelper.createPartName(rel.getTargetURI());
sheetMap.put(rel.getId(), wb.getPackage().getPart(relName));
}
}
assertEquals(4, count);
}
+
+
+ /**
+ * Iterating over a workbook with chart sheets in it, using the
+ * XSSFReader method
+ * @throws Exception
+ */
+ public void test50119() throws Exception {
+ OPCPackage pkg = XSSFTestDataSamples.openSamplePackage("WithChartSheet.xlsx");
+ XSSFReader r = new XSSFReader(pkg);
+ XSSFReader.SheetIterator it = (XSSFReader.SheetIterator)r.getSheetsData();
+
+ while(it.hasNext())
+ {
+ InputStream stream = it.next();
+ stream.close();
+ }
+ }
}