Hi I'm trying to find and replace mail merge tags in word document. I was able to replace simple mail merge tags by using regex pattern find and replace.
I read the document using docx4j api and did a find and replace for mail merge tags
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
Document wmlDocumentEl1 = (Document) documentPart.getJaxbElement();
org.docx4j.wml.Document wmlDocumentEl = (org.docx4j.wml.Document) documentPart.getJaxbElement();
// xml --> string
String xml = XmlUtils.marshaltoString(wmlDocumentEl, true);
HashMap<String, String> mappings = new HashMap<String, ...