0
votes

i am using Docx4j to generate pdf documents based on Microsoft Word templates.

In a microsoft word template, i have some Mail Merge fields, which should be replaced. I am able to replace Mail Merge field but in generated PDF are displayed in a wrong way.

In output PDF i have always text like MERGEFIELD ContractNo * MERGEFORMAT. In word, you can swith between field views by ALT+F9, but how can i achieve to show in generate PDF different view of mail merge fields?

Instead of MERGEFIELD ContractNo * MERGEFORMAT i want to show only ContractNo.

2

2 Answers

0
votes

Should "just work" with a current nightly build (as opposed to 2.8.1).

-1
votes

Use Content Controls instead of MERGEFIELDs. I've posted an example on github complete with a sample template and a sample XML data file: https://github.com/sylnsr/docx4j-ws ... MergeFields are deprecated and not (IMHO) recommended for continued use.