I'm trying to export a word document which is about 2-3 pages. I use 2 images, one for header and another one for footer.
The problem is the header and footer images only appear on front page but not on the other 2 pages.
Currently I'm using docx4j 3.2.1. How can I fix this issue?
This is my code:
if(footerFileFlag){
java.io.InputStream footerImage = new java.io.FileInputStream(footerFilePath);
FooterPart footerPart = new FooterPart();
Relationship footerRel = wordMLPackage.getMainDocumentPart().addTargetPart(footerPart);
Ftr ftr = objectFactory.createFtr();
ftr.getContent().add(newImage(wordMLPackage,footerPart, BufferUtil.getBytesFromInputStream(footerImage), "footerImage", "alttext", 1, 2));
footerPart.setJaxbElement(ftr);
FooterReference footerReference = objectFactory.createFooterReference();
footerReference.setId(footerRel.getId());
footerReference.setType(HdrFtrRef.FIRST);
sectPr.getEGHdrFtrReferences().add(footerReference);
footerPart.setJaxbElement(ftr);
}