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:
Asked
Active
Viewed 380 times
0
-
you'll need to post sample input and output docx somewhere – JasonPlutext Mar 20 '18 at 21:23
1 Answers
0
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);

JasonPlutext
- 15,352
- 4
- 44
- 84