Hi,
I am merging 3 docx files into 1 and then converting it to pdf.
Whilst adding a header and footer (objects retrieved from other docx files) into the body i set the following:
headerReference.setType(HdrFtrRef.DEFAULT); // FIRST / DEFAULT / EVEN
footerReference.setType(HdrFtrRef.DEFAULT); // FIRST / DEFAULT / EVEN
// SectPr
SectPr sectPr = objectFactory.createSectPr();
sectPr.getEGHdrFtrReferences().add(headerReference);
sectPr.getEGHdrFtrReferences().add(footerReference);
I use:
wordprocessingMLPackageBody.getMainDocumentPart().getJaxbElement().getBody().setSectPr(sectPr);
not:
wordprocessingMLPackageBody.getMainDocumentPart().addObject(sectPr);
because the body i am merging the header and footer into already has a ...