Aspose.Words

Prepare a Document

Before you execute a mail merge, you need to prepare the document template. You should insert merge fields that will be replaced with values from your data source.

Inserting Merge Fields into a Document:

1.       Open your document in Microsoft Word.

2.       In the document, click where you want to place a merge field.

3.       Open the Insert menu and select Field... to open the Field dialog.

4.       From the Field names list, select MergeField.

5.       In the Field name text box, enter a name for the merge field and press OK.

Now you have a new merge field placed in your document. Microsoft Word shows it like this:

Of course, since a merge field is a regular Microsoft Word field, you can switch between displaying field codes and results in your document in Microsoft Word using the keyboard shortcut Alt+F9. Field codes appear between curly braces: