From 9730ff9cd6e87e160374d5e110ceb297705060f4 Mon Sep 17 00:00:00 2001 From: David North Date: Thu, 6 Aug 2015 15:57:48 +0000 Subject: [PATCH] Proposed refactor for: https://bz.apache.org/bugzilla/show_bug.cgi?id=58219 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1694531 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/XSSFWorkbook.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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 */