Caused by: com.sun.istack.SAXException2: unable to marshal type "org.docx4j.dml.CTBaseStylesOverride" as an element because it is missing an @XmlRootElement annotation
Sample code:
- Code: Select all
Chart c = new Chart(new PartName("/ppt/charts/chart" + (chartId) + ".xml"));
CTBaseStylesOverride override = new CTBaseStylesOverride();
//set override details here
JaxbXmlPart<CTBaseStylesOverride> overridePart = new JaxbXmlPart<CTBaseStylesOverride>(
new PartName("/ppt/theme/themeOverride" + (chartId) + ".xml"),
ContextFactory.getContext("org.docx4j.dml")) {
};
overridePart.setRelationshipType(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride");
overridePart
.setContentType(new ContentType("application/vnd.openxmlformats-officedocument.themeOverride+xml"));
presentationTemplate.getParts().getParts().put(c.partName, c); //my PresentationMLPackage
overridePart.setJaxbElement(override);
c.addTargetPart(overridePart);