Table of Contents | |
---|---|
|
Creating a Merge Field
Excerpt |
---|
OfficeWriter's WordTemplate object opens a WordWriter template file, populates it with data from one or more data sources, and generates a new Word file. A WordWriter template is a file created in Microsoft Word that |
...
contains merge fields. A merge field displays a data source field name (for example, a database column name) where a data source value will be inserted. Merge fields are bound to a data source in OfficeWriter code. When you run the code, OfficeWriter replaces the merge fields with values from the data source and creates a new Word file. |
WordTemplate's SetDataSource method binds the merge fields to a data source, which may be an array or a database table record. The Process method enters values from the data source in the template's merge fields.
...
- In Microsoft Word, open or create a document to use as your WordWriter template.
- Create a text fragment, a list, or a table row that contains merge fields. For example:
- Select the text, list, or table row that you want to define as a repeat block. For example:
- Open the Insert menu and select Bookmark... to open the Bookmark dialog.
- Enter a bookmark name and click Add.
...
- In Microsoft Word, open or create a document to use as your WordWriter template.
- Create a text fragment, a list, or a table row that contains merge fields. For example:
- Insert Next fields where you would like the data source to move to the next row when it hits a repeat of the same merge fields.
...
- In Microsoft Word, open or create a document to use as your WordWriter template.
- From the View menu, select Toolbars -> Mail Merge.
- Click the Open Data Source icon.
- Select a database. For example, open the Access database Northwind.mdb, located in WordWriter\doc-samples\samples\database.
- Select a database table from the list.
- Click the Insert Merge Fields icon.
- From the Fields list, select a field (a column name) and click Insert. Repeat to add additional fields to the template.
- To format a merge field, right-click the merge field and select Edit field... to open the Field dialog. For more information about the Field dialog, see Creating a Merge Field.
Anchor | ||||
---|---|---|---|---|
|
Example: Creating an Envelope Template
...
- Open Microsoft Word.
- To display the Mail Merge toolbar, open the View menu and select Toolbars -> Mail Merge.
- Click the Main document setup icon.
- Select Envelopes.
- In the Envelope Options dialog, select envelope size, address fonts, and printing options.
- Enter merge fields in the envelope's delivery and return address boxes (within the main document). For instructions, see Creating a Merge Field.
Anchor | ||||
---|---|---|---|---|
|
Example: A Fax Cover Template
...
- In Microsoft Word, open the File menu, and select New...
- From the New Document window, select General Templates...
- In the Templates dialog, select the Letters & Faxes tab.
- Select one of the available fax templates.
- Insert merge fields in the template.
Anchor | ||||
---|---|---|---|---|
|
...