Using Microsoft Word Fields in Documents
Mergefields in Microsoft Word are placeholders used in mail merge documents. They allow you to insert dynamic content — such as names, addresses, or other personalized information — into a template. When you perform a mail merge, Word replaces these mergefields with actual data from a data source (like an Excel spreadsheet or a database) to create personalized documents, such as letters, labels, or envelopes.
Microsoft Word supports about 60 different fields and supports formula evaluations. The field consists of two parts: field/formula code and its actual value. You can toggle between field’s codes and values via Toggle Field Codes menu or by pressing Alt+F9.
When we process document template, we replace MERGEFIELDs with corresponding record values.
In some scenarios it might be useful to place the MERGEFIELD inside another field (IF for example) or formula. But substitution of MERGEFIELD does not trigger outer formula re-evaluation.
As fields are specific to Word document format, PDF conversion component evaluates and replaces all Word fields with their values. To apply field re-evaluation feature for Word documents check the Update fields
checkbox (which is unchecked by default for safety) to the document template settings.
Update fields option in documents
When checked, after replacing MERGEFIELDs with their values an additional pass is performed evaluating and replacing with their values all remaining fields in the document.
Examples
Example 1: Text as a result of comparison
Consider the field: { IF { MERGEFIELD Amount } = 1 One Many }
First pass will replace { MERGEFIELD Amount } with actual value of the Amount, say 2. However, calculated value of the IF field displayed to the user remains the same. With Update fields checked, second pass will evaluate { IF 2 = 1 One Many } and replace it with word Many.
Example 2: Formatting numbers
TeamDesk supports limited set of format modifiers on MERGEFIELDS directly, but you can use full Word’s potential using MERGEFIELD inside formula field.
Consider the scenario: a financial document with contract’s sum is written in words. Word has a nice CardText modifier, just for that. All you need to do is to place merge field inside the formula field with CardText modifier.
{={MERGEFIELD Contract_Sum} \* CardText}
On first pass we will replace {MERGEFIELD Contract_Sum} with a value, say 1000, updating outer field’s code to {=1000 * CardText}. With Update fields checked, second pass will replace {=1000 * CardText} with calculated value, words one thousand.