Docx4J get header/footer elements from docx file and modify them

Waqas Memon picture Waqas Memon · Jul 1, 2013 · Viewed 8.2k times · Source

I am using Docx4J to modify docx templates and put values in place of placeholders in the template that are predefined.

so far, i had been successful in finding and replacing paragraphs and texts, tables, images etc. But i am not yet successful in finding Header and/or Footer elements of the document.

I am using

WordprocessingMLPackage wordMLPackage =
WordprocessingMLPackage.load(new java.io.File(inputfilepath));
wordMLPackage.getMainDocumentPart(); 

to search for elements in the template.