Run a template for a number of data sets, and print the merged documents

Remember that a data set in XpressDox terms is the set of data elements used in a template. The data values come either from being captured by the user, or from data source, or both. This data set is saved whenever a template is run (and the merged document saved), in a location and with a name depending on the configuration for the template folder.

By default the data set is saved in the same folder as the template, and with the same name as the saved merged document but with the extension “xddata.xml”.

This example will assume you have set up an application in a manner similar to that described in Configure a multi-application environment above. In other words, the data sets all contain a data element with a client’s account number, and, in particular, the data sets are saved in files whose name is the account number.

Suppose, then, you have decided to do something like send a newsletter to each client, and want to personalise it with information from the data set for each client.

For this you would use the XpressDox “Batch Run Templates” button on the XpressDox toolbar or ribbon in Word. This feature:

  • presents you with a list of templates to choose – the one you want will either be in the Recent Files list, or else you use the Explorer to navigate to where the template is. Select the template.
  • presents you with a list of data sets to choose – choose the ones you want.

The system then runs the template against each data set, and leaves the merged documents open in Word.

Once all the documents have been merged, you can print them all using the Print All Documents button in the XpressDox Utilities toolbar, and then close them all with the Close All Documents button.

Notice that in the first bulleted step above you could actually choose any number of templates to be run. If more than one template is chosen, the XpressDox will run each template against each of the chosen data sets.

An important point to be aware of is that if a template contains «IncludeDataSourceData()» or «IncludeFileData()» commands, then the XpressDox Batch Run feature will assume that ALL the data elements for the template(s) will be supplied by those data sources or data files. You will NOT then be presented with the opportunity to choose a list of data sets.