While we perform mail merge through Docx4j API , we got the output in a docx file but when we open it in Microsoft Word 2010 an alert message appear:
It is currently Sun Nov 24, 2024 7:06 am
RelationshipsPart rp = wordMLPackage.getMainDocumentPart().getRelationshipsPart();
org.docx4j.relationships.Relationship hdrRelationship = rp.getRelationshipByType(Namespaces.HEADER);
HeaderPart hdrPart = (HeaderPart)rp.getPart(hdrRelationship);
HeaderPart newHdrPart = new HeaderPart();
newHdrPart.setContents(XmlUtils.deepCopy(hdrPart.getContents()));
wordMLPackage.getMainDocumentPart().addTargetPart(newHdrPart, RelationshipsPart.AddPartBehaviour.RENAME_IF_NAME_EXISTS);
content = newHdrPart.getContent();
mergeMSWordDocContentViaDocX4J(wordMLPackage, content, replacementMap);
Total posts 10111 • Total topics 2842 • Total members 2074