Inserting text files via data field

Prev Next

You can insert the content of other text files like Word, RTF or HTML via data field. For example, if you want to display different texts on training certificates depending on the participant’s success level. The data source contains the partial file path to the text file and the dox42 Word Add-In completes and follows this path to include the text file into the generated document.

Congratulations message highlighting dox42 expertise and celebrating outstanding performance.

Example for a text file for inclusion

Steps

  1. Add the needed text file(s) in or below the same folder as the Word template.

  2. Set up your data source to contain the partial file path to the text file. In the following example the text files are stored in a subfolder named Textblock.

    List of participants with their success status and training details in a table format.

    Example of a text file data field in an Excel data source

  3. Open your Word template.

  4. Go to the dox42 ribbon and select Insert Data Field.

    Toolbar displaying various functions like Generate, Data Map, and Refresh Template options.

    dox42 ribbon

    The dox42 Data Fields pane opens, which contains with all the components of the Data Map.

  5. Insert a new data field or select the already inserted data field in the document template that contains the path to text file.
    The details of this placeholder are displayed in the dox42 Data Fields pane.

  6. From the Type dropdown select one of the following entries:

    1. WordDoc

    2. Rtf

    3. Htmlfile

  7. In the Directory/URL text field enter the <%DOCPATH%> variable to complete the file path to the text files.
    The <%DOCPATH%> variable contains the document template’s path. In our example the dox42 Word Add-In will now complete the path defined in our Excel data source with the document template’s folder path.
    This could look like this: C:/Document Templates/Training_Certificate/TextBlock/Distinction.docx

    Settings for creating a Word document with directory path placeholder displayed.

    WordDoc settings

  8. Select OK.

  9. Save the Word template.

Result

You have inserted a text file via data field. When you generate the document, the data field will include the contents of the text files.

A training certificate congratulating Martina Musterfrau on her outstanding performance and success.

Generated document with included content from the text file Distiction.docx