QR Codes and Barcodes in Document Creation tasks

The following tutorials will cover how Therefore™ can be used to generate QR codes and barcodes in the document creation workflow tasks.

Mapping Index Data to Template Fields

Index data can be mapped to template fields using scripting. This is similar to an Update Index Data task. The document will have the same name as the template unless it is renamed using the following script:

Copy
Profile.SetDocumentName("Document name");

Custom Document Properties

Index data values can also be written into custom document properties. To do so, create a new custom document property in your template file.

  1. Click on File -> Info -> Properties -> Advanced Properties.

  2. Switch to the “Custom” tab and enter a Name and Value for the custom property.

  3. Click 'Add' and then 'OK' to save the new custom document property.

  4. Save the template and close Word in order for Therefore™ to access it.

  5. Open a document creation workflow task in Therefore™ and select the template that was just created/edited.

  6. Click 'Add' and select 'Add Document Property'. Then choose the created property from the drop-down menu.

  7. Assign an index data value that should be saved inside the custom document property.

QR Codes in Word Documents

Therefore™ is only able to modify existing barcodes if they are using a Custom Document Property as a value. Creating those and assigning index data to them is described in the tutorial above.

  1. To create a modifiable QR Code in a Word template, press Ctrl + F9 and type “DisplayBarcode” with a space at the end:

    Copy
    {DisplayBarcode }
  2. Leave the text cursor at that position and click on Insert - Quick Parts - Field.

  3. The “Field” window will be displayed that allows users to choose a field.

  4. Choose the Custom Document Property previously created. It can be found in the list under “DocProperty”. Next, click on OK.

  5. Type “ QR” to specify that the barcode should be displayed as a QR code.

    Copy
    {DisplayBarcode test QR}

Note:

  • In the example above, the term 'test' is the Custom Document Property and not something hard coded.

  • Refer to the relevant Microsoft documentation for additional barcode types and formatting options.
    Field codes: DisplayBarcode

With 'Toggle Field Codes' it is possible to choose between textual and graphic representations. The textual representation is displayed as above, while the graphical one will display the QR code itself.

This QR code will display the value of the specified Custom Document Property. It will be automatically updated when converting the Word document with Therefore™. Please note that Microsoft Word will not show the updated value automatically. To update the field, click 'Update Field' from the context menu.

Inserting Content Controls

Content Controls or Form Fields can be inserted into a Microsoft Word template using the Developer tab in Microsoft Word. Please find more information about the Developer tab using the relevant Microsoft documentation:

Developer Tab Documentation

Using Quick Parts to insert Content Controls is currently not supported. Fields that are inserted using Quick Parts store data in a certain XML format (XML Data Binding) instead of plain text.

Insert Images into the Picture Content Control

Images can be inserted into a Picture Content Control. As there is no index data type in Therefore™ that can hold images it needs to be provided as a string.

To be able to load pictures from the file system the scripting safe mode needs to be turned off. This is not allowed in Therefore™ Online, limiting this feature.

The pictures should be base64 encoded and contain format information, similar to the HTML/CSS format. This is a cut example of an image encoded that way:

Copy
data:image/png;base64,iVBORw0KGgoAA

Common image types like PNG, JPEG, GIF, BMP, and TIF are supported. In the assignments, an image could either be provided via scripting or as a static string.

For loading an image file from a disk using scripting, a FileSystemObject is required. This object can only be created with the safe mode turned off.
Images can be assigned to the Body, as well as the Header and Footer of the document. The image will fill the Content Control without changing its' aspect ratio. Unused space in the Content Control will be removed.