The "Getting Started" manual says "TraversalUtil can also be applied to headers, footers etc.". I only got TraversalUtil under mainDocumentPart. How to pass footers to TraversalUtil?
I tried walk the parts:
- Code: Select all
Body body;
RelationshipsPart rp = opcPackage.getRelationshipsPart();
for (Relationship r : rp.getRelationships().getRelationship()) {
Part part = rp.getPart(r);
if (part instanceof JaxbXmlPart) {
Object o = ((JaxbXmlPart) part).getJaxbElement();
if (o instanceof org.docx4j.wml.Document) {
body = ((org.docx4j.wml.Document) o).getBody();
new TraversalUtil(body, this);
}
}
}