Sub-Templates
Smart Document allows you to inject Word sub-templates when generating the final document. To do so, the user will use the Add Sub-template function. Once added the tag can be edited in different ways.
Overview
The structure for the usage of sub-templates is as follow:
The reference link between the Master template and the sub-template(s) can be static or dynamic.
- Static link: The link to the sub-template is static and will always be the same
- Dynamic link: The link to the sub-template is dynamic and the sub-template(s) pulled at generation time will vary depending on a quote variable (field or column)
Before Getting Started
It's important to know that:
- Sub-templates tags cannot be placed in the header, the footer or properties of the Word document.
- Lock password set in a Sub-Template will be ignored.
- Concerning Word styles and formatting, the Master template is the one that will drive:
- Styles (headings, paddings, etc.)
- Header and footer content
- Fonts
There will be different settings to be performed both on the Master template and the Sub-template(s)
How to Set Up the Master Template
HOW TO INSERT A SUB-TEMPLATE IN A MASTER TEMPLATE - STATIC LINK
The insertion of the sub-template tag is done in a new paragraph after the cursor position.
| STEP | DESCRIPTION | IMAGE |
|---|---|---|
| 1 | Place the cursor in the Word document where the sub-template should be inserted. In the add-in on the Home tab, click on the + next to the Sub-template menu. | |
| 2 | Define a name for the Tag with no space and enter the name of the sub-template Word document (without extension). | |
| 3 | Click on the ADD SUB-TEMPLATE button | |
| 4 | The tag appears in the Word document. The add-in display the edit mode for the sub-template. |
HOW TO INSERT A SUB-TEMPLATE IN A MASTER TEMPLATE - DYNAMIC LINK
The insertion of the sub-template tag is done in a new paragraph after the cursor position.
| STEP | DESCRIPTION | IMAGE |
|---|---|---|
| 1 | Place the cursor in the Word document where the sub-template should be inserted. In the add-in on the Home tab, click on the + next to the Sub-template menu. | |
| 2 | Tick the "Based on variable" box. | |
| 3 | Select a tag from the list where the name of the template will be filled in the quote. Important Note: In the quote model the field or column used to retrieve the name of the template should be a string type. The data in this field or column must match exactly the name of the sub-template without the extension. | |
| 4 | Click on the ADD SUB-TEMPLATE button. | |
| 5 | The tag appears in the Word document. The add-in display the edit mode for the sub-template. |
HOW TO EDIT A SUB-TEMPLATE IN A MASTER TEMPLATE
To edit a sub-template the cursor must be positioned on the tag in the Word part of the document. In the add-in click on the edit button as below:
The edit a sub-template panel allows to modify:
if you're using a static sub-template
- the sub-template tag name (except the fixed “#Type_ID_” section)
- the sub-template filename.
if you're using a dynamic sub-template reference
- the sub-template tag name
- the source data tag
It also allows you to switch from static to dynamic and vice versa.
Once the edits have been made the user must click on the button to save the changes. If the user needs to cancel and not save the changes they must click on
.
HOW TO DELETE A SUB-TEMPLATE IN A MASTER TEMPLATE
To delete a sub-template:
- delete the sub-template tag on the Word document side.
- click on the delete button in the Edit sub template panel
Once the edits have been made click to save the changes. To cancel and not save the changes click on
.
HOW TO INSERT A SUB-TEMPLATE IN ITERATION IN MASTER TEMPLATE
A Sub-template can be used in the context of an iteration. In that case, the objective is to insert sub-templates dynamically based on the line items stored in the quote. That's why dynamic link should be used in that specific use case.
All sub-templates must be stored in the zip file published on PROS cloud. In the quote model the field or column used to retrieve the name of the template should be a string type. The data in this
field or column must match exactly the name of the sub-template without the extension.
| STEP | DESCRIPTION | IMAGE |
|---|---|---|
| 1 | Insert an iteration in the Master template. Place the cursor in the Word document where the iteration should be inserted after In the add-in on the Home tab, click on the + next to the Iteration menu. | |
| 2 | Select the data context for the iteration by choosing a component in the drop-down list. The Data Context is either: View/Component: User can choose a View/Component Parent source: If iteration is placed in a parent iteration the user can use parent Data Context Useful Tip: Type text in the drop-down lists to filter the results. | |
| 3 | Click on ADD ITERATION | |
| 4 | The iteration tags appear in the Word document. | |
| 5 | ||
| 6 | Follow the process of inserting a sub-template with dynamic link as explained above. Note: The first data in the list are the columns of the component your iteration is based upon. | |
| 7 | The tag appears in the Word document inside the iteration tags. The add-in display the edit mode for the sub-template. |
How to Set Up Sub-templates
GENERAL
- All sub-templates files must have a docx extension.
- All sub-templates files must have a json datasource filled in. This json datasource should be the same as the one used in the Master template.
- The sub-templates files name must match exactly the name declared in the master template (for static link) or the value of the quote field/column on which the dynamic link is based on.
TO SET UP SUB-TEMPLATES
| STEP | DESCRIPTION | IMAGE |
|---|---|---|
| 1 | Load the Data Model. To do so, go to the Settings tab. Click on to load the Data Model, which must be a valid JSON file and the same as the one you loaded on the Master template. | |
| 2 | Add the tags needed to the template. | |
| 3 | Save the template file. |
HOW TO SET UP SUB-TEMPLATES IN ITERATION
Additional steps are required when setting a sub-template in an iteration. Follow the steps described below.
Settings tab
| STEP | DESCRIPTION | IMAGE |
|---|---|---|
| 1 | Load the Data Model. To do so, go to the Settings tab. Click on to load the Data Model, which must be a valid JSON file and the same as the one you loaded on the Master template. | |
| 2 | Edit the sub-template iteration settings. | |
| 3 | Select the option "This sub-template is part of an iteration in a master template." By doing so the sub-template is able to retrieve the context from the parent Master template datasource. | |
| 4 | Select the same component that was used to set the iteration in the Master template. | |
| 5 | Save the settings. |
Inserting tags
Now that the settings are done, tags can be inserted into the document. As the datasource has been defined in the settings, the list of tags available for insertion are narrowed down to the column of the component used in the Master template iteration and fields.
Let's take a simple example, the sub-template has been placed in an iteration to insert product datasheets corresponding to the lines contained in the quote.
| STEP | DESCRIPTION | IMAGE |
|---|---|---|
| 1 | Now it is time to build the datasheet. Static content is placed in the document | |
| 2 | Add place holders for information coming from the quote, in our case the price and the discount. | |
| 3 | Add tags to retrieve the data from the quote corresponding to the price and the discount. Place the cursor in the Word document where the field should be inserted. In the add-in on the Home tab, click on the + next to the Tag menu. Note: Insertion is done with the TAG function not the TABLE function. | |
| 4 | Select a "sub-template column" by browsing through the components of the Data Model using the Data tag autocomplete drop-down list. Useful Tip: Type text in the drop-down lists to filter the results. | |
| 5 | Click on the ADD TAG button. | |
| 6 | The tag appears in the word document. The add-in display the edit mode for the field. |
