Troubleshooting Print Templates
As you create and test your print templates, use these suggestions to help resolve problems. Note that many of these apply specifically to Word and PDF templates, rather than HTML-based templates.
Check for these common syntax issues:
- Parentheses and brackets. Make sure each one is part of a pair, with one opening and one closing the phrase. If you're working with many nested sets of parentheses or brackets, you can copy and paste the text into an HTML editor like Notepad++. These editors highlight the other half of a pair as you move your cursor, so it's easier to tell when a pair is unfinished.
Smart quotes (“”). Make sure only plain quotes ("") are used inside formulas. Formulas won't work correctly with smart quotes.
To disable automatic smart quote formatting, go to File > Options, open the Proofing section, click AutoCorrect Options, go to the AutoFormat tab, and clear the "Straight quotes" with "smart quotes" checkbox.
Formula page breaks. Check each page break to make sure formulas aren't spilling across the break. Formulas broken between pages do not work correctly. If you have a formula near the end of the page, and you aren't sure whether it breaks across the page during testing, you can follow the steps in the Broken Paragraphs section below to force the formula to stay together.
- Nested $startif() commands. If the page has a $startif() call inside another $startif(), either on purpose or due to missing parentheses, they won't work correctly.
- Formula validity. Test your formulas to make sure they work as expected. If you're using a formula for the first time, try testing it with simpler inputs, or test your inputs one at a time.
- Reenter the field. If you can't identify the problem, try deleting and retyping the field name, rather than copying and pasting. Pasting can include formatting and field codes behind the scenes that sometimes cause problems.
- Enforce formatting. Make sure the document has consistent formatting and font.
You can also try copying and pasting the entire document into a new Word document to remove ghost formatting.
There are often sections of print templates that need to stay together. For example, you might want to keep all signature lines together on the same page, so that if the preceding text gets too long, the entire signature section jumps to the next page together. You can make sure sections of the template stay together on the same page.
- Highlight the entire section that you need to keep together.
- Right-click the selection and click Paragraph.
- In the Paragraph window, click the Line and Page Breaks tab.
- Select the Keep with next and Keep lines together checkboxes.
- Click OK.
Now, the selected paragraphs will always stay together as a whole.
Refer to Embedding Tables and Fields from Tables for information about including tables. If you're building a complex table, here are some formatting tips for working with tables in Word:
- To move an individual cell outside the alignment of its neighbors, double-click the cell before you drag its borders.
- If the ruler is enabled (View ribbon > Ruler checkbox), hold Alt while dragging a border to show the table measurements on the ruler. This makes it easier to center and distribute cells evenly.
- Tables tend to change shape when you enter long field names, or when the field contents is longer than the field name. To prevent this, right-click the table and select Table Properties. Click Options at the bottom and clear the Automatically resize to fit contents checkbox.
Make sure to use the Format Painter tool to apply a consistent style to your print template. In particular, use the Format Painter to apply a consistent style to formulas, starting at the
$. For example, if you have a $startif formula with an $endif, you should highlight everything from the first
$ to the final
f in $endif.
If the print template's final output has style problems, but not the original print template, check the style applied to the text inserted to replace formulas and variables. If the style is different than the rest of the document, you might need to modify that style to make it match the style used in the rest of the text, or apply that style to the text in the original print template. For example, inserting text from an HTML field is often automatically set to the Normal (Web) style in Microsoft Word, while the print template body is usually written in the Normal style. Setting the print template body to Normal (Web) or setting Normal (Web) to the same formatting as Normal can fix this issue.
For best results, store clauses as Microsoft Word files and use the Print Template option to prioritize the template's formatting. For complex clauses, or clauses that contain images, set the specific clause to use AltChunk using the customaltchunk=true parameter. If you need a single clause to both use automatic numbering and include an image, the best method is to split the clause into two parts, so that the numbering can be handled using the print template formatting and the image can be handled using AltChunk.
If the text or list style in the final product still doesn't match the style in the print template, you might need to review the style preference settings for your system, the specific print template, and potentially the individual clause being inserted.
First, if the issue comes from inserting a clause, and the clause is stored in a Microsoft Word file rather than an HTML text field, review the text of the print template to locate the variable pointing to that clause text.
- If it includes the customaltchunk=true parameter, that means the clause is rendered using AltChunk, a feature of Word that preserves the formatting in the clause file rather than converting it to match the template's formatting. AltChunk is necessary if you want to include images, or if the clause is very complex, but it is not compatible with automatic list numbering at the template level. In the template, look for this syntax:
- If that parameter is included, try removing it; if it isn't included, try adding it.
Next, edit the Word/PDF template itself and check the style preferences drop-down setting. This controls the style preference for the whole print template.
Use Global Settings. Follows the settings in the global variables to determine how to format the contents of the selected field.
Print Template. Applies the print template styles to any inserted fields. If a clause contains a bulleted or numbered list, that list is converted to the styles in the print template. This option does not support inserting images from clauses.
Field. Uses Microsoft Word's AltChunk paradigm to embed the field's contents with the field's original styles applied. This option does not support automatic numbering.
Finally, if the lower-level settings weren't the problem, check the global variable settings. Log in as an administrator and go to Setup > System > Manage Global Variables.
Remember that any change to global variable settings affects all print templates in the system, not just the one you're troubleshooting.
- Locate the "Style preference for paragraphs in Printed Document" global variable. Set this variable to
printtemplateto use the style in the print template, or set it to
fieldto use the style coded in the field.
If you set this variable to
printtemplateand you still see problems with styling, check that all the styles used in the print template have the same font and font size. This includes both the problem text and the Microsoft Word style definitions, which you can access by right-clicking the active Style and clicking Modify.
When this variable is set to
printtemplate, the print template still respects use of bold, italics, and underlining in the field content. If you need to override that behavior, go to the Customized Variables tab and select New > Choice Constant. Create a new global variable named
print_template_pref_useRunRprand set its value to No.
If you set this variable to
field, the formatted contents of an HTML field is retained in the final product. This is generally only used when users copy and paste formatted content from another program like Word directly into the field. If you use this setting, test your print templates thoroughly because Word doesn't recognize all HTML constructs, even if they are correct in HTML.
- Locate the "Use AltChunk while running a Print Action" global variable. Set it to No to use the bullet and numbering lists formatted by Microsoft Word, or set it to Yes to ignore Word's automatic list functions and embed field content exactly as-is. In most cases, you want to set this variable to No, which allows usage of automatic numbering in print templates.
If you need to include bookmarks in the final product of a Microsoft Word template, you can configure the system to preserve bookmarks from print templates. To do so, go to the Customized Variables tab and select New > Choice Constant. Create a new global variable named
print_template_remove_bookmark and set it to No. This setting applies only to Word print templates, not PDF or HTML formats.