Adding templates to a document specification

You can include one or multiple templates in a document specification and generate a document-style report from the document specification.

Before you begin

About this task

Note: Windows icon As an alternative to this task, you can also drag and drop .dta files from a Windows explorer directory into the Templates section of the Document specification view.

Procedure

  1. In the Document Specification view, right-click Templates.
  2. Click Add templates.
  3. Select a tab to choose one or more templates to add:
    • Load from library:
      1. Select a template from the library.
      2. Click Add selected.
      3. Repeat to add more than one template to the document specification.
      4. Use the Up and Down buttons to order the templates in your document specification.
    • Open local or remote:
      1. To select templates, enter a URL and click Add URL or click Browse to select a template from your computer or server.
      2. Repeat to add more than one template to the document specification.
      3. Use the Up and Down buttons to order the templates in your document specification.
      Tip:
      • When you publish the document-style report, each template is executed in the order it are specified in the document specification.
      • You can use relative paths, HTTP paths , or HTTPS paths to related resources in document specifications. When you use relative paths, you can change the directory structure of your files and still access the files necessary to generate document-style reports. You are prompted to choose between using relative paths or absolute paths when the document specification is saved, when the template is in the same folder as the document specification, when the template is in a child folder of the folder that contains the document specification, or when the template is in a parent folder of the folder that contains the document specification. You cannot specify a relative path to a parent folder of a parent folder.
    Note: You can use the same template multiple times with different configurations for its data sources.
  4. Click Finish.
  5. Optional: If you must change the order of the templates again after closing the Add template window, reorder the templates by dragging them into the correct order in the Document Specification view.
    In most situations, the templates are listed in the Document Specification view in the order in which they display in your generated report.

Results

After you add a template to the document specification, the data sources and variables that are specified in the template are also added in the Document specification view.

Example

Table 1. Multi-template document-style report example
Template file name Template contents Explanation of use
titlePage.dta Title page, Table of contents Generates the title page
masterPage.dta Header, Footer Generates the header and footer for each page of the document-style report
Introduction.dta Paragraph introduction Provides an introduction for the report
Data.dta Tables of data Generates the data from the data source
Summary.dta Include file for summary Includes a Microsoft Word file with an analysis of the data