When to use IncludeTemplate in your XpressDox template:
In the case of the IncludeTemplate command, 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.
When to use InsertTemplate in your XpressDox template:
Use InsertTemplate rather than IncludeTemplate when the template to be included is not known at the time of authoring the template. The template may rely on input from the user to decide which template to insert:
«If(ClauseFile != '')»
Rely on input from the user:
This command will put a control onto the interview which will enable the user to browse for and choose a template (or a document) 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.
When running the template on the web, a user can upload a template or a document into the control placed on the interview.
Construct the file name from data elements:
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.xdtpx”. 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. InsertDocument will continue to function, for backward compatibility purposes, but the Command Assistant will refer only to InsertTemplate.