Table of Contents
Overview
A Document is a Word-based template that will be processed and then appended to the PDF output of a Print Process. The process works as follows:
- A button will trigger a print process to kick off.
- For each document in the print process, the document stubs will be replaced with the dynamic runtime values from the the calculations, whether those are input or output values. These replacements will occur based on the defined mapping.
- In the order that the print documents are defined, the documents will be appended to one another.
- The cumulative output will be converted into PDF format and provided to the user for download.
You can also save the output of a Print Process to the database instead of downloading it (further details in the Database Designer -> Defining Columns section of the help pages.)
Adding a Print Document
In order to add a new document to an existing print process, simply select the Add button above the documents list.
There are a couple of properties that should be chosen while creating the print process document.
Document Name
A friendly name that will help you identify the document in the future. This is not utilized within the system for anything.
Document Type
A document can be a Single meaning that it will be printed once. A Repeating document on the other hand is tied to a Table Named Range and it will be printed out more than once according to chosen table named range. More details on repeating documents can be found in the next section.
Enabled
Indicates whether the print process document is enabled. If the document is not enabled this document won't be printed while other documents belonging to the same process is being printed.
This can be configured as Always or Never to indicate whether the print process document is statically enabled or not.
Alternatively, if any Boolean Single Named Ranges (SNR) exist (i.e. ranges pointing to a single cell that evaluates to TRUE or FALSE), then the enabled-ness of the print process document can be configured to reflect the value of that named range using the 'By Value Of' setting.
Document File
The Word-based document that will act as a template for the document generation. This document should include stubs if you expect to inject content dynamically in the document.
Note: The file type must be a *.DOCX file for the system to be able to process it appropriately.
Recursive Print Process
Repeating Document
Instead of creating several templates that look similar to each other, you can create one recursive print process and tie the repeating logic to a table named range. This way, you will be able to create one process where the number of pages in the export are dependent on the outcome of an input or output table.
To create a repeating print process, you must have a template that contains the appropriate stubs in it that correspond to the columns of your table named range.
The document below will repeat for each row in the data input table that contains data. For example, 5 entries into the underlying table named range will result in a 5 page PDF export with the corresponding row data printed into the stubs.
The export document will look like this,
Repeating Table
The idea behind creating tables with this method is building tables that change in size, based on the number of rows that contain data.
To create a recursive table, your workbook needs to have a table named range that allows more than one row of data, and a Word document that contains column headers as stubs to be used in creating the print process.
You can create a dynamic table structure by inserting a document that only consists of the headers and another document that consists of the column stubs. The header document may look like below,
Document Type option under the Edit menu should be set to Single Document.
The column stubs document needs to contain the column field names to be printed, inside double curly braces. This section must be added as a separate document and the rest of the table will be generated from this second document. The table document may look like below,
Document Type option under the Edit menu should be set to Repeating Document since this document will repeat as many times as necessary to create the dynamic table.
The final table will be drawn based on Skip Row Type selection and how many table rows contain matching data. The resulting table in the export document might look like this,
Recursive Print Document Options
Repeating Table Named Range option needs to target the table data that is to populate in the export table. If your table named range contains headers, remember to enable Has Header checkbox.
Skip Row Type determines the rules for selecting the rows that are to be included in generating the export table. Options include,
None: No rows will be skipped and the table will be created based on the size of the table named range selected.
All Empty: Rows that have no data in any column will be skipped.
By Value of Column: This selection creates another option named Enable by Column. The column selected under this new option must have a value for the row to be not skipped. In other words, rows that have data in the selected column will be included in the export table.
Existence of Column Values: Rows will be skipped if no data is present in columns which is set as required in Edit Document Stubs page.
Skip Subsequent Page Break option removes page breaks after each iteration of a repeating print process. When creating a dynamic table, enabling this option will ignore any page breaks and create a continuous table. If you’d like each row to be printed on a separate page, uncheck this option.
What is a Document Stub?
A document stub is a specifically formatted string token that is placed inside of a Word document with the intention of acting as a placeholder for other content, which will likely be output generated by the Excel model or input entered by the user from the web interface.
A stub takes the following form: {{ HelloWorld }}
. A stub is distinguished by the double curly brackets enclosing it on either side. The document stub name
is the value inside the double curly brackets - in this example, the stub's name is HelloWorld
.
Document stubs can have the following types:
- Text: A string value with the stub format somewhere in your Word-based template document.
- Image: A string value with the stub format placed at the Alt Text property of an image in your Word-based template document.
To create a Text stub, simply add a string value with the stub format somewhere in your Word-based template document. For example, you may have a financial planning tool that should generate a document beginning with the following:
Dear Jim,
Thank you for the opportunity to assist you in assessing your financial plan [...]
However, each individual that uses your financial planning tool will not be named 'Jim'. As a result, your template will need to consider the first name as a piece of dynamic content that will be updated based on the user's first name entry. A document stub should be inserted as such:
Dear {{ FirstName }},
Thank you for the opportunity to assist you in assessing your financial plan [...]
Upon upload to the system as part of a print process, this document stub will be detected with the name FirstName
. You can also utilize the same stub numerous
times throughout your document template if you have need of showing the same value repeatedly.
Note: The name of the document stub does not need to match any named ranges in the system since you will be able to map document stubs to corresponding named ranges in the Edit Document Stubs page. However, using stubs with names corresponding to named ranges will make the mapping process easier, since the system will auto-detect corresponding names and automatically associated them.
To create an Image stub, simply add a string value with the stub format placed at the Alt Text property of an image in your Word-based template document. For example, you may have a financial planning report that should generate a document including a bar chart:
When applying formatting to a stub, you must apply the same formatting to the double curly braces for the system to recognize it. For example, this stub will not include the selected formatting of highlight, bold, and italicize:
The total cost of the goods selected is, {{ total_due }}.
This following stub will contain the applied formatting:
The total cost of the goods selected is, {{total_due}} .
Known Limitations
Word documents that contain shapes with an image set as a background fill are not supported and will cause the print process to fail. Please remove shapes with these settings and replace them with actual images to proceed without error.