我有一个表,我需要向其中添加多行,而不是您在图像中看到的变量。我正在使用 docx4j。
我改变这样的变量:
HashMap mappings = new HashMap();
VariablePrepare.prepare(template);
mappings.put("example", "example");
template.getMainDocumentPart().variableReplace(mappings);
Run Code Online (Sandbox Code Playgroud)