Construct a letterhead for your templates

The concept of using a centralized letterhead is very useful in document automation.

 

Use InsertTemplate to pull in the letterhead templates:

This article describes the use of IncludeTemplate (the preferred method) or, in fewer cases, BaseTemplate. It also provides some tips on the design of the letterhead. But how about where you should be storing your letterheads?

 

 

Make use of Helper folders in the configuration

Templates can pull letterheads from any folder structure; you can decide what you want this structure to be as discussed in Step 4 here.

The concept to bear in mind is this: when a template is run by XpressDox, the internal environment is set up according to the configuration of the folder in which that template was saved (i.e. the folder where the template is run from). In other words, every time a template is run, XpressDox makes sure that its containing folder’s configuration is active.

To make sure that those templates which require a letterhead all use the same letterhead, there are a few things to set up:

 

  • First, the letterhead template must be created, and must be saved in a suitable location (in the case of a multi-user environment, a suitable location would be a shared folder on the network). For this example, suppose that location and file name is .\XpressDox templates\Live\Letterheads\Header.xdtpx

 

  • In the Helper folders tab in the Configuration, a short name (Alias) can be assigned to the location .\XpressDox templates\Live\Letterheads e.g. “letterheads”

 

  • Every template requiring that letterhead must have the following command «IncludeTemplate(.\XpressDox templates\Live\Letterheads\Header.xdtpx)» in the header of the template, but the alias means that you can shorten the command to «IncludeTemplate(letterheads:Header.xdtpx)»

 

  • When a template with the «IncludeTemplate(letterheads:Header.xdtpx)»command is run, XpressDox will look in the configuration of that template’s containing folder to find the path to where the Header.xdtpx template can be found. In other words, it will look for a definition of the Aliasletterheads”.

 

  • Defining an alias in the Configuration is done by following these steps:
    1. Run the XpressDox Configuration, ensure you have selected the correct folder at the top, and select the Helper Folders tab.
    2. Click on the “New Helper Folder” tab and browse to the path of your Header template.
    3. Should you be using this Configuration on your Cloud account, you may need to upload your DocumentAssembly.config.xml file onto your cloud account. Be sure to make the file path a relative one, and not an absolute path. Your Cloud account will not be able to understand a C drive, or a network drive.
    4. Save the configuration.

 

 

This means that regardless of where a template is saved, as long as the folder in which it is saved has the “letterheads” Helper Folder configured to the Letterhead template’s containing folder, and the IncludeTemplate command refers to the template as “letterheads:Header”, then the correct letterhead will be used.

Note that you do not have to include the file extension .xdtpx when referring to a template in any XpressDox command. If omitted, the extension is inferred as .xdtpx.

 

 

The configuration screen for a typical template folder which was configured as above would look something like:

 

Letterheads in XpressDox Document Automation

Where the path at the top is the highest level of my XpressDox templates folder, meaning anything configured at this level would be available to all templates/folders contained within.
And the path to the helper folder is relative to the configuration folder path at the top.

 

 

Another setting to note is the “Relative Folders and Versioning” tab. Choose the first option here “Make folders relative to this configuration folder”

Letterheads in XpressDox Document Automation

 

For a more advanced application of configuration which also applies to the subject of letterheads as well as other configuration options, please see the Cookbook article Configure a multi-application environment.