I've just started to evaluate docx4j-3.1.0.jar and it seems to suit my need.
Unfortunately I found a problem with it.
My requirement is to merge fields in a document and in a contained table as well.
I wrote a helper function to to the latter and found that the former is giving me headaches. The former is done via org.docx4j.model.fields.merge.MailMerger.getConsolidatedResultCrude and this seems to delete all other merge fields. This is a problem as the second step iterates the table, find any fields in it and adds additional lines with some (merged) text.
i wrote a small test program which shows the problem and attached it.
It reads in the document inTable.docx which has 3 fields (two in a table and one global). The code replaces the outer field with the text "FooBar" which is done correctly. Sadly, the other two fields are gone also as can be seen in the output file outTable.docx
My question is on how to proceed?