Hi, I am testing the example XX and I have a problem.
This is the code...
import java.util.HashMap;
import org.docx4j.XmlUtils;
import org.docx4j.openpackaging.io.SaveToZipFile;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.wml.Document;
public class VariableReplace {
public static void main(String[] args) throws Exception {
String inputfilepath = System.getProperty("user.dir") + "/resource/template.docx";
boolean save = true;
String outputfilepath = System.getProperty("user.dir")
+ "/resource/OUT_VariableReplace.docx";
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage
.load(new java.io.File(inputfilepath));
MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
// unmarshallFromTemplate requires string input
String xml = XmlUtils.marshaltoString(documentPart.getJaxbElement(), ...