diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index 153fc05d9..cb9ba9a5f 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -377,14 +377,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable(shIdMap.size()); for (CTSheet ctSheet : this.workbook.getSheets().getSheetArray()) { - XSSFSheet sh = shIdMap.get(ctSheet.getId()); - if(sh == null) { - logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping"); - continue; - } - sh.sheet = ctSheet; - sh.onDocumentRead(); - sheets.add(sh); + parseSheet(shIdMap, ctSheet); } // Load the external links tables. Their order is defined by the order @@ -408,6 +401,17 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable shIdMap, CTSheet ctSheet) { + XSSFSheet sh = shIdMap.get(ctSheet.getId()); + if(sh == null) { + logger.log(POILogger.WARN, "Sheet with name " + ctSheet.getName() + " and r:id " + ctSheet.getId()+ " was defined, but didn't exist in package, skipping"); + return; + } + sh.sheet = ctSheet; + sh.onDocumentRead(); + sheets.add(sh); + } + /** * Create a new CTWorkbook with all values set to default */