Use Cases
The reference pages describe each document function on its own. The use cases show how the building blocks work together: Each example leads from the data source to the place in the document and contains every configuration in full, ready to copy.
Examples
| Use case | Data source | Building blocks |
|---|---|---|
| Letter with a recipient from an address data source | User, address data source | Forms (Object, DataProvider), Fields, Bind field |
| Case number from the business application in the header | Third-party system via Connect | Data, Fields, Placeholder Mapping, Placeholder Definition, Global Translations |
| Participant list as a table | User | Forms (ObjectCollection), Fields (WordTableRows), Bind field |
Structure of an example
Every example follows the same structure: starting point and result, the building blocks involved with a link to the reference, the data flow, the configuration step by step with the reason for every non-obvious step, testing without a production system, variants and pitfalls.
The examples use neutral names: systems by their role («business application», «address data source»), English ids, labels set directly in Label. The configurations therefore work without preparation and can be taken over into any Datasource. For multilingual templates, use translate-Label with global translations; only the case-number example requires such a translation, because its label follows the document language.
Data types at a glance
Where a type comes from, what it delivers in code and how it gets into the Word document. Origin: Forms, Data, Fields, profile, snippets, global translations. Inserting: Bind field, placeholder in the layout.
| Type | Origin | Value in JavaScript | Inserting in Word |
|---|---|---|---|
Text | Forms, Data, Fields, profile | String | plain-text content control («Bind field») or Text placeholder in the layout |
Choice | Forms | selected option Value as String; label via $.getChoiceLabel(…) | via a Text field |
Date | Forms, Fields | date object; .Value for $.formatDate(…), $.getDateAsText(…) for the formatted text | date content control or Text placeholder in the layout |
YesNo | Forms, Fields | Boolean | not directly; drives logic in Fields, in PowerPoint the visibility via tags |
FormattedText | Data, Fields, global translations, snippets | FormattedText | rich-text content control |
WordContent | Data, Fields, snippets | WordContent | rich-text content control, own paragraphs |
InlineWordContent | Fields | InlineWordContent, exactly one paragraph | rich-text content control within a paragraph |
WordTableRows | Fields | WordTableRows | the content row of a table, copied for every entry |
Picture | Fields, profile (e.g. Profile.Org.Logo) | image | picture content control or Picture placeholder in the layout |
Object | Forms, Data, Fields | JavaScript object with the schema ids as properties; null when no entry was created | not directly; output via a field |
ObjectCollection | Forms, Data, Fields | array of such objects; empty is [] | not directly; output via a field, e.g. WordTableRows |
Details: Return value of field types, Objects and ObjectCollections in code, Field type per Office application.