return new org.docx4j.openpackaging.parts.DrawingML.DiagramDrawingPart(new PartName(partName));
} else if (contentType.startsWith("application/vnd.openxmlformats-officedocument.drawing")) {
try {
return JaxbDmlPart.newPartForContentType(contentType, partName);
} catch (Exception e) {
return new BinaryPart( new PartName(partName));
}
} else if (contentType.startsWith("application/vnd.openxmlformats-officedocument.presentation")
|| contentType.equals(ContentTypes.PRESENTATIONML_MACROENABLED)
|| contentType.equals(ContentTypes.PRESENTATIONML_TEMPLATE)
|| contentType.equals(ContentTypes.PRESENTATIONML_TEMPLATE_MACROENABLED)
) {
try {
return JaxbPmlPart.newPartForContentType(contentType, partName);
} catch (Exception e) {
return new BinaryPart( new PartName(partName));
}
} else if (contentType.equals(ContentTypes.SPREADSHEETML_WORKBOOK)
|| contentType.equals(ContentTypes.SPREADSHEETML_WORKBOOK_MACROENABLED)
|| contentType.equals(ContentTypes.SPREADSHEETML_TEMPLATE)
|| contentType.equals(ContentTypes.SPREADSHEETML_TEMPLATE_MACROENABLED)) {
try {
return new WorkbookPart(new PartName(partName));
} catch (Exception e) {
return new BinaryPart( new PartName(partName));
}
} else if (contentType.startsWith("application/vnd.openxmlformats-officedocument.spreadsheetml")) {
try {
return JaxbSmlPart.newPartForContentType(contentType, partName);
} catch (Exception e) {
return new BinaryPart( new PartName(partName));
}
} else if (contentType.equals(ContentTypes.OFFICEDOCUMENT_THEME_OVERRIDE)) {
return new org.docx4j.openpackaging.parts.DrawingML.ThemeOverridePart(new PartName(partName));
} else if (contentType.equals(ContentTypes.DIGITAL_SIGNATURE_XML_SIGNATURE_PART)) {
return new org.docx4j.openpackaging.parts.digitalsignature.XmlSignaturePart(new PartName(partName));
} else if (contentType.equals(ContentTypes.APPLICATION_XML)
|| partName.endsWith(".xml")) {
// Rarely (but sometimes) used, owing to OFFICEDOCUMENT_CUSTOMXML_DATASTORAGE above.
// Simple minded detection of XML content.
// If it turns out not to be XML, the zip loader
// will catch the error and load it as a binary part instead.
log.warn("DefaultPart used for part '" + partName
+ "' of content type '" + contentType + "'");
return CreateDefaultXmlPartObject(partName );
} else if (contentType.equals(ContentTypes.PRESENTATIONML_FONT_DATA)) {
return new FontDataPart(new PartName(partName));
} else {
log.error("No subclass found for " + partName + "; defaulting to binary");
//throw new PartUnrecognisedException("No subclass found for " + partName + " (content type '" + contentType + "')");
return new BinaryPart( new PartName(partName));
}
}