Reputation: 1
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.
Upvotes: 0
Views: 1734
Reputation: 8763
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.
Upvotes: -1
Reputation: 15878
Should "just work" with a current nightly build (as opposed to 2.8.1).
Upvotes: 0