Inserting templates with variable names (Part 1)

In the case of the BaseTemplate and IncludeTemplate commands, the name of the template to be included is known at the time the template is authored, and so the actual file name of the template is referenced in the command.

In some situations, the name of a file to be included in the document is contained in the Data Set. In these cases, instead of IncludeTemplate, the command InsertTemplate is used:

«If(ClauseFile != '')»

This command will put a control onto the interview which will enable the user (i.e. the person running the template) to browse for and choose a template to be inserted into the current position in the document.  The browser will open up at the folder which is configured as the Clauses Library Folder for that template.

Another way of using the InsertTemplate command is to construct the name of the template to be inserted using information known at the time the template is run.  For example, suppose you want to include a template containing the signature of a person whose name is in the data element Signatory and the template file name for a person called “Fred”  is “SignatureFred.xdtpl”.  The code to achieve this is:


Please also see the article Source and destination formatting.

Please also see the article Inserting documents with variable names (Part 2) as there as some important new features discussed there.

Note that this command was originally called InsertDocument. The InsertDocument command will continue to function, for backward compatibility purposes, but the Command Editor will refer only to InsertTemplate. The reason for this change is two-fold, one to be compatible with/parallel to IncludeTemplate, and secondly because the documents to be inserted really must be XpressDox templates, not any Word document, and so the old name might have been misleading.

Table of Contents