Hi there,
I have a template which contains the text %%WEBSITE%%. I would like to replace all occurrences of this text with a website.
I've been able to locate the org.docx4j.wml.Text object that contains this text; my attempts of replace the text with a hyperlink have failed.
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(templateFile);
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
org.docx4j.wml.Document wmlDocumentEl = (org.docx4j.wml.Document) documentPart.getJaxbElement();
String xpath = "//w:r[w:t[contains(text(),'%%WEBSITE%%')]]";
System.out.println("XPATH " + xpath);
List<Object> list = documentPart.getJAXBNodesViaXPath(xpath, true);
for ...