// 2. Create a new Package
// Eventually, you'll also be able to create an Excel package etc
// but only the WordML package exists at present
ContentTypeManager ctm = new ContentTypeManager();
try {
InputStream is = getInputStreamFromZippedPart( partByteArrays, "[Content_Types].xml");
ctm.parseContentTypesFile(is);
} catch (IOException e) {
throw new Docx4JException("Couldn't get [Content_Types].xml from ZipFile", e);
} catch (NullPointerException e) {
throw new Docx4JException("Couldn't get [Content_Types].xml from ZipFile", e);
}
// .. now find the name of the main part
RelationshipsPart rp = RelationshipsPart.createPackageRels();
populatePackageRels(partByteArrays, rp);
String mainPartName = PackageRelsUtil.getNameOfMainPart(rp);
String pkgContentType = ctm.getContentType(new PartName("/" + mainPartName));
// 2. Create a new Package; this'll return the appropriate subclass
OpcPackage p = ctm.createPackage(pkgContentType);
log.info("Instantiated package of type " + p.getClass().getName() );
p.setRelationships(rp);
rp.setSourceP(p); //