我正在尝试将数据从一个xml文件填充到docx模板中,该模板会生成多个word文件
public static final String input_DOCX = "E:\\Temp5\\Word document template.docx";
public static final String input_XML = "E:\\Temp5\\Word document data.xml";
public static final String output_DOCX = "E:\\Temp5\\Word document output.docx";
public static void main(String[] args) throws Exception {
WordprocessingMLPackage wordMLPackage = Docx4J.load(new File(input_DOCX));
FileInputStream xmlStream = new FileInputStream(new File(input_XML));
Docx4J.bind(wordMLPackage, xmlStream, Docx4J.FLAG_BIND_INSERT_XML | Docx4J.FLAG_BIND_BIND_XML | Docx4J.FLAG_BIND_REMOVE_SDT);
Docx4J.save(wordMLPackage, new File(output_DOCX), Docx4J.FLAG_NONE);
System.out.println("Saved: " + output_DOCX);
我想要类似于此代码的内容,但需要多个docx文件。如果有人可以帮助我,我将非常感激。预先感谢!