Ensure that XSSFWorkbooks contain a BookView, some corrupt ones do not contain this, e.g. ones created by movescound.com

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1648158 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-12-28 09:08:58 +00:00
parent 1cf8152d14
commit 26585f4e95

View File

@ -238,6 +238,13 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable<X
// Build a tree of POIXMLDocumentParts, this workbook being the root
load(XSSFFactory.getInstance());
// some broken Workbooks miss this...
if(!workbook.isSetBookViews()) {
CTBookViews bvs = workbook.addNewBookViews();
CTBookView bv = bvs.addNewWorkbookView();
bv.setActiveTab(0);
}
}
/**
@ -261,6 +268,13 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable<X
// Build a tree of POIXMLDocumentParts, this workbook being the root
load(XSSFFactory.getInstance());
// some broken Workbooks miss this...
if(!workbook.isSetBookViews()) {
CTBookViews bvs = workbook.addNewBookViews();
CTBookView bv = bvs.addNewWorkbookView();
bv.setActiveTab(0);
}
}
/**