Word: Templating - Basics

Word: Templating - Basics


Are you a template administrator and would like to edit a template or create a new template? Learn the basics of templating in this article.

If you are not yet familiar with the template editor, find out more here: https://primesoft-group.atlassian.net/wiki/x/AQDZEQ

Open template in editor

To edit a template in the corresponding Office application (e.g. Word), select the Editor button in the template editor or use Ctrl+E.

First make sure you know where exactly you need to make a change. In the header or in the content? Open the correct template in the template hierarchy.

In this example, the Letter template is being edited using a content template. If you have several language versions of the template, first select which language version you want to edit.

Client-TemplateEdit-LangOptions-20240514-111140.png

The template is now opened in the respective Office application, in this example Word.

In the template editor The Properties, Profile and Document language buttons are deactivated.

In the editor

Edit-WordTemplate-20240514-143546.png

Edit content

(1) As we are editing a content template in this example, you can completely ignore the headers and footers when editing - these are already defined in the layout. Read more about the template hierarchy here: Templates and template types | Word templates

All entries in square brackets, e.g. [Salutation], are primedocs fields. If you click on the [Salutation] field, you will see Salutation (Field, unmapped). This means that it is a primedocs field that was not defined in the Placeholder Mapping document function, but is a field that comes directly from the Fields document function.

Templating group

(2) The “Templating“ group offers primedocs' own tools to dynamize the template. The following buttons are available:

Bind field

The pop-up window that opens allows you to select profile fields and fields that have been configured in the Fields document function.

Insert snippet placeholder

A snippet placeholder is inserted as a snippet of the type Word content (WordContent) in order to then define what is filled in the WordContent field (a forms field, a field or profile data directly). Snippet placeholders can be filled with text. More information on this can be found here: Code | snippets API (in German)

Insert placeholder

The placeholder is the container for inserting dynamized content into the header or footer of a layout template. Dynamized content can be profile fields or a field defined in the Fields document function, for example.

This button is deactivated in this example because we are in a content template and not in a layout template.

Developer tools

Siehe Beschreibung weiter unten: Word: Templating - Basics | Developer tools (Test)


Test document

Once you have edited the template, you want to check whether your changes are correct in a generated document.

Return to the template editor and click on “Test document” or use Ctrl+T. Now fill in all the parameters as if you were a user. The document will then be generated in test mode.

Template editing group

Options-Document-Tested-20240514-142126.png

The advantage of testing a document is that the template editing group is then available to you in the open Word document, with the following options:

Generate preview

A "snapshot" is taken of the document at that moment and set as a preview image for this template.

Generate multilingual previews

Generate a preview image depending on the document language.

Developer tools (Test)

When solving problems with template construction, it is often valuable to have an overview of what data was returned by forms or fields when creating a document and exactly which styles are available. The developer tools display this data clearly:

image-20240812-160157.png

Registers in prioritised order

  • "FieldPart" tab: contains all data that is stored after the document has been completed, e.g. forms and field values

  • "DocData - WordStyles" tab: a list of all Word styles in this document and their normalised StyleId.

Example WordStyle:
StyleId normalized: NoSpacing (StyleId in current document 'KeinLeerraum') (Name: No Spacing), Type: Paragraph

The StyleId is used in global translations of type FormattedText in the data-word-style-id attribute. The StyleId in this example is “NoSpacing“.

  • TestingPart" tab: the "Test document" button is only filled when a document is created and then contains more detailed information about which template version was used.

  • "BasicPart" tab: Basic data, such as the TemplateId

  • "DocData" tab: a so-called "FlatOpc" - a flat representation of the entire Word document as XML

 

IMPORTANT
When you have finished editing templates, switch the Administration view off again. This way, the signatures and campaigns that are actually released to you as a user are drawn in Outlook correctly.

PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland