Docx4j API performing mail merge for input dotx to output docx file giving alert

410 views Asked by At

While we perform mail merge through FieldMailMerge.java , we got the output in a docx file but when we open it in Microsoft Word 2010 an alert message appear:

enter image description here

1

There are 1 answers

0
JasonPlutext On

Configured with OutputField.REMOVED, the mail merge was removing an empty paragraph from a table cell. But as per the error message, Word requires a w:p in each w:tc (ie a w:tc can't be empty).

So removing such a w:p is a bug, now fixed at https://github.com/plutext/docx4j/commit/13c48ce3f2fb2cbad02b784b6dcf1930428bb9e8

Or you can use something other than OutputField.REMOVED, for example: org.docx4j.model.fields.merge.MailMerger.setMERGEFIELDInOutput(OutputField.DEFAULT);