Preparing a Document with Merge Fields
You can use two types of merge fields, both of which have the syntax <<Field Name>>. You can use simple merge fields to update a Word document with specific values in a data source. You can use table merge fields to fill out a table in a Word document for each row in a data source. This document describes how you can add merge fields to your document to take advantage of the document merge rule's functionality.
Example: You want to create an invoice template that includes a customer’s billing address, invoice number, and purchase details. You can add merge fields for the billing address and invoice number, and then, with a table, you can define a region called "MyItem" in the second row that is replaced with specific items that the user orders. This looks like:
Adding Simple Merge Fields
- Open a Microsoft Word document.
- Click where you want to place a merge field.
- In the Insert tab, click Quick Parts and then Field….
- Under Categories, select (All).
- Under Field names, select MergeField.
- Type the name of the merge field under Field name.
- Click OK.
Note: You cannot manually insert brackets to generate a merge field.
Editing Simple Merge Fields
- Right-click the merge field.
- Click Edit Field….
- Provide updated information in the dialog.
- Click OK.
Tip: To insert a field quickly, press Ctrl + F9 and then edit the field.
Adding Table Merge Fields
When you create a field merge table in Word, you need to define the region in a table row in which you are going to replace the data. You can do this using specially named starting and ending merge fields.
- Open a Microsoft Word document.
- Add a table with two rows. In the first row, include headers for the table. In the second, define the updated region.
- In the first column of the second row, add a field merge called “TableStart:MyObject” and replace “MyObject” with the name for the region.
- In the last column of the second row, add a field merge called “TableEnd:MyObject” and replace “MyObject” with the name for the region.
- After the first field merge and before the last field merge, add simple merge fields for each column header.
Once the merge document is ready, you can preview test values before using the merge document in a Run Rule activity that is configured to use a document merge rule.