A scenario similar to a “mail merge” can be achieved in XpressDox.
Say you want to print the same document for a number of clients, where all the contact information for those clients, as well as any other pertinent information for the document content, is contained in a database. And you only want to send this document to all clients where the column “Mailshot” in the database table contains the value “yes”.
The database is configured as a data source called “Clients”.
A snippet of a template to do this would look like:
«IncludeTemplate(Header)»«Comment(this goes in the header of the template and includes a template containing the header part of the letterhead)» «IncludeDataSourceData(Clients,,range=Mailshot = ‘yes’)» «ForEach(Client)» «If(position() > 1)».......[Insert a Page Break]......«End()»«Comment(See below for an explanation of this part)» Dear «Salutation» Body of letter «End(foreach client)»
«If(position() > 1)» will insert a page break at the beginning of each client except for the first, so that the letter to each client appears on its own page. In constructing the Word template, where the text “….[Insert a Page Break]….” appears above, you would insert a Word page break, and take care that there are no paragraph ends between the
«If(position() > 1)» and its
«End()». Have a look at the template “Invitation(Like a Mailmerge)” in the My Documents\XpressDox\Samples folder.
Note that this produces one long Word document, each letter on a new page. Should you need one Word document per letter then make use of the MergeTemplate feature.