I have a requirement to update the header on first page of a .docx file.
This can be achieved using:
SectPr sectPr = sections.get(sections.size() - 1).getSectPr();
headerReference = objectFactory.createHeaderReference();
headerReference.setId(relationship.getId());
headerReference.setType(HdrFtrRef.FIRST);
sectPr.getEGHdrFtrReferences().add(headerReference);
But the above doesn't work unless Title page is set to true.
BooleanDefaultTrue boolanDefaultTrue = new BooleanDefaultTrue();
sectPr.setTitlePg(boolanDefaultTrue);
When the above is done, footer on first page of document is replaced by some junk (perhaps default) footer.
If I set headerReference.setType(HdrFtrRef.DEFAULT), the footer ...