Word

This section explains the configuration of Documotor in Word, describing how to bind transformed data to your Microsoft Word document.

In order to define what data goes where in the document, we utilize Word’s native functionality, Content Controls.

The types of bindings described in this section are usually placed in the tag of a rich text content control.

The placement of the content control in the document defines where the data is inserted, and the keys and values in the tag defines what data is inserted at that specific location.

The content control binding will consist of two values – BindingType and BindingKey. The articles in this section explains the various BindingTypes, and thus describes how to bind data to fields, images, tables, showing/hiding sections of the document and more.

Read below for information on the BindingKey property of the binding.

Binding keys

Bindings are resolved from the binding scope based on the path defined. Initially the scope of the document is the whole dataset.

For example, a document created with the following dataset:

{
   "title": "Product Quote",
   "contact": {
     "name": "John Doe"
   },
   "products": [
     {
       "name": "Grey Tile",
       "price": "40 $"
     },
     {
       "name": "White Tile",
       "price": "39 $"
     }
   ]
 }

Can have field bindings made for:

title -> "Product Quote"
contact.name -> "John Doe"
products[0].name -> "Grey Tile"
products[0].price -> "40 $"
products[1].name -> "WhiteTile"
products[1].price -> "39 $"

Some bindings instead evaluate the binding value to determine a true/false value. Because any data can be evaluated we refer to these as a truthy or falsy. For a full list of falsies, see Truthy values. Anything that is not a falsy is truthy. An example is the visibility binding where the following bindings could be made:

title -> true
contact.name -> true
products -> true
services -> false
products[0].name -> true
products[0].qty -> false

Paths are relative to the current scope. The scope starts at the root of the data and can change in case of some nested bindings, for example a field binding inside a table binding. If a binding doesn’t mention change of scope, it means the scope is unchanged even in case of nested bindings. For example if there is a field inside a visibility, then the field will have the same scope as the visibility.

A path can consist of a property name or/and index as shown in the example above. Besides this, the path can also be @. @ is the current scope and is useful in cases where you have an array of values like the following example:

{
  "products": [ "Grey Tile", "White Tile"]
}

If we then take the example of a field inside a table, the table would bind to products, while the field can then bind to @.