...
This document function can be used to link content in order to integrate it into the document. Assuming
Suppose you use the Forms function to retrieve request a date and a title from the user and want to place this data together in a footer, you . You can then use this document function to combine output the date field and the two text fields into a separate text fieldtext 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
Code Block | ||
---|---|---|
| ||
<FieldsConfiguration> <Fields> <!-- Insert form elements and groups here --> </Fields> </FieldsConfiguration> |
...
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
Code Block | ||
---|---|---|
| ||
<FieldsConfiguration> <Fields> <Text Name="Page" translate-Value="Content.Page" /> </Fields> </FieldsConfiguration> |
...
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. Code (german)
Code Block |
---|
<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.
Code Block | ||
---|---|---|
| ||
<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. Code (german)
...
Date
Code Block | ||
---|---|---|
| ||
<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
Code Block | ||
---|---|---|
| ||
<FieldsConfiguration> <Fields> <YesNo Name="InsertPartnerLogo" Value="true" /> </Fields> </FieldsConfiguration> |
...
Code Block | ||
---|---|---|
| ||
<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: https://primesoft-group.atlassian.net/wiki/spaces/PDTEN/pages/61407710/Global+Configurations#Working-with-typed-fields.
...
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:
Code Block | ||
---|---|---|
| ||
<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:
Code Block | ||
---|---|---|
| ||
<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
Code Block | ||
---|---|---|
| ||
<FieldsConfiguration> <Fields> <!-- Fill placeholdersplaceholder from layout --> <Picture Name="PartnerLogo" Asset="\\e123\User\DoeMuster\ExampleLogoBeispielLogo.PNG" /> <Text Name="Page" Value="PageSeite" /> <!-- get FormattedText --> <FormattedText Name="Title"> <Code>$.translations.getFormattedText("FormattedTexts.FormattedTitle")</Code> </FormattedText> <!-- Data onlyin inthe content of the template --> <Text Name="Greeting" translate-Value="Greetings.KindRegards1" /> <!-- ReferenceReferencing 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: