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
This commit is contained in:
parent
f28588fbb3
commit
9730ff9cd6
@ -377,14 +377,7 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable<X
|
||||
// of CTSheet elements in the workbook
|
||||
sheets = new ArrayList<XSSFSheet>(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<X
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseSheet(Map<String, XSSFSheet> 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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user