Fields
- 1 Purpose and use
- 2 Basic structure
- 3 Elements
- 3.2 Text
- 3.2.1 Attributes for Text
- 3.3 FormattedText
- 3.4 WordContent
- 3.5 Date
- 3.5.1 Attributes for Date
- 3.6 YesNo
- 3.6.1 Attributes for YesNo
- 3.7 Picture
- 3.7.1 Attributes for Picture
- 3.8 GlobalFields
- 3.8.1 Attributes for GlobalFields
- 3.8.2 Modify fields
- 3.8.2.1 Example
- 4 Example
- 5 Fields in Office templates
Purpose and use
This document function can be used to link content in order to integrate it into the document.
Suppose you use the Forms function to request a date and a title from the user and want to place this data together in a footer. You can then use this document function to output the date field and the text field together in one field. This also allows you to manage what happens if the user does not fill in both forms fields.
Basic structure
<FieldsConfiguration>
<Fields>
<!-- Insert form elements and groups here -->
</Fields>
</FieldsConfiguration>
Elements
Attributes that are offered for all elements:
Attribute name | Description |
---|---|
| Is required for identification. Must not contain any spaces and must be unique. |
Attribute values from global translations
Some attributes can be filled with the value of a global translation instead of a fixed value. These attributes are each preceded by a translate-
. The two attributes are mutually exclusive, so only a fixed value or a translated value may be used.
Text
<FieldsConfiguration>
<Fields>
<Text Name="Page" translate-Value="Content.Page" />
</Fields>
</FieldsConfiguration>
Attributes for Text
Attribute name | Description |
---|---|
| Predefined text that the user can edit. |
FormattedText
FormattedText allows the insertion of formatted text. FormattedText is both a type of global translation and a type of text module.
When inserting using global translations, it is possible to output differently formatted text passages in a content control in the document, depending on profile data or selected data in forms. This is often used in headers and footers, for example, because bold and non-bold styles are often used in one content control.
Attributes for FormattedText
There are no further attributes. The dynamisation of content and data is made possible in the code
element with JavaScript and the software's own functions. https://primesoft-group.atlassian.net/wiki/x/DgC7Fw
<FieldsConfiguration>
<Fields>
<!-- FormattedText get as global translation -->
<FormattedText Name="EnclosuresTitle">
<Code>$.translations.getFormattedText("FormattedTexts.EnclosuresTitle")</Code>
</FormattedText>
<!-- FormattedText Get as snippet -->
<FormattedText Name="SimpleSnippet">
<Code>$.snippets.getFormattedText("FormattedTexts.SimpleSnippet")</Code>
</FormattedText>
</Fields>
</FieldsConfiguration>
WordContent
The WordContent field allows the dynamic insertion of multiple text sections into a template. Together with the Forms document function, more complex templates can be realised or several templates can be consolidated into one.
<FieldsConfiguration>
<Fields>
<WordContent Name="Introduction">
<Code>$.snippets.getWordContent("Introduction")</Code>
</WordContent>
</Fields>
</FieldsConfiguration>
Attributes for WordContent
There are no other attributes. The insertion of WordContent is made possible in the code element with JavaScript and the software's own functions. https://primesoft-group.atlassian.net/wiki/x/DgC7Fw
Date
<FieldsConfiguration>
<Fields>
<Date Name="CreateDate" Format="yyyy-MM-dd">
<Code>$("Forms.Date").Value</Code>
</Date>
</Fields>
</FieldsConfiguration>
Attributes for Date
Attributname | Description |
---|---|
| Date format for display in the document. The tooltip for Format shows a list of possible placeholders for the time units. |
YesNo
<FieldsConfiguration>
<Fields>
<YesNo Name="InsertPartnerLogo" Value="true" />
</Fields>
</FieldsConfiguration>
Attributes for YesNo
Attribute name | Description |
---|---|
| Predefined value of the entry that the user can edit. |
Picture
<FieldsConfiguration>
<Fields>
<Picture Name="PartnerLogo">
<Code>$("Profile.Org.PartnerLogo")</Code>
</Picture>
</Fields>
</FieldsConfiguration>
Attributes for Picture
Attribute name | Description |
---|---|
| Specification of an asset in an Image Gallery, only available in PowerPoint: Although the |
GlobalFields
The GlobalFields
element can be used to retrieve a globally stored Field.
<FieldsConfiguration>
<Fields>
<GlobalFields Key="Fields.Report" />
</Fields>
</FieldsConfiguration>
GlobalFields can be referenced in any Fields configuration - in a template or in an entry in the global configuration.
More information about the global configurations can be found here: Global Configurations | Working with typed fields.
A concrete example for recognizing the connection between the global entry and the reference to a global entry can be found here: Global Configurations | Referencing global entries in the templates.
Attributes for GlobalFields
The reference to a global entry is made using the Key
attribute. If you select it, a list of all available global entries is automatically displayed.
Attribute name | Description |
---|---|
| The ID of the global entry to be referenced. |
Modify fields
The Modifications
element in GlobalFields
allows the modification of any field that is included by referencing the GlobalField in the field pipeline during document generation.
To modify a field, the Modifications
element is opened in the GlobalField. In it, the field to be modified is redefined with the same name and its value or code
is defined differently. This means that the original field is not included in the field pipeline during document generation, but the modified field is.
Example
The GlobalField with Id Fields.IsPresident
contains a YesNo
field with the value true
. The configuration looks like this:
<FieldsGlobalFields>
<YesNo Name="IsPresident" Value="true" />
</FieldsGlobalFields>
In a template, false
is to be used for the YesNo field IsPresident
as an exception. To achieve this, IsPresident
is redefined in the fields configuration of this template:
<FieldsConfiguration>
<Fields>
<GlobalFields Key="Fields.IsPresident">
<Modifications>
<YesNo Name="IsPresident" Value="false" />
</Modifications>
</GlobalFields>
</Fields>
</FieldsConfiguration>
If a document is generated from the template, the new definition is now taken into account and the value false
is used - even if this field is referenced in other fields.
Example
<FieldsConfiguration>
<Fields>
<!-- Fill placeholder from layout -->
<Picture Name="PartnerLogo" Asset="\\e123\User\Muster\BeispielLogo.PNG" />
<Text Name="Page" Value="Seite" />
<!-- get FormattedText -->
<FormattedText Name="Title">
<Code>$.translations.getFormattedText("FormattedTexts.FormattedTitle")</Code>
</FormattedText>
<!-- Data in the content of the template -->
<Text Name="Greeting" translate-Value="Greetings.KindRegards1" />
<!-- Referencing a global entry -->
<GlobalFields Key="Letters.Subject" />
<!-- get WordContent-Snippet -->
<WordContent Name="Introduction">
<Code>$.snippets.getWordContent("Introduction")</Code>
</WordContent>
</Fields>
</FieldsConfiguration>
Fields in Office templates
As already explained in https://primesoft-group.atlassian.net/wiki/x/JgGpAw , the fields are then inserted manually into the template. Depending on their type, they are inserted as a specific content control, which creates a DataBinding between primedocs and the document. DataBindings are tracked in documents by primedocs and the fields are continuously validated during document generation and when the document is updated.
Overview of inserted content control per field type
The following table shows which field type is inserted into the template as which content control:
Field-Typ | Content control |
---|---|
Text | PlainText (only text) |
FormattedText | RichText |
WordContent | RichText |
Date | Date |
YesNo | Cannot be inserted. |
Picture | Image |
Overview of field type per Office application
As a supplement, the following matrix shows which field type can be used in which Office applications:
| Word | Outlook (web) | PowerPoint | Excel |
---|---|---|---|---|
Text | ||||
FormattedText | * | |||
WordContent | ||||
Date | ||||
YesNo | ||||
Picture |
*Outlook e-mails and signatures are only saved in HTML in the web-enabled Outlook version. This means that
Global translations of the FormattedText
type can contain any HTML elements via the FormattedText
field in Outlook templates and are therefore more flexible than global translations that are inserted in Word or PowerPoint templates.
A list of permitted HTML elements in Word and PowerPoint templates can be found here:
PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland