Replacing Bookmarks With Text (Dynamic)
  • Updated on 05 Mar 2019
  • 4 minutes to read
  • Print
  • Dark
    Light

Replacing Bookmarks With Text (Dynamic)

  • Print
  • Dark
    Light

Overview

This tutorial shows how to replace Bookmarks in a Word Document with desirable Text . The Step that can be used for this function is called a Replace Bookmark With Text (Dynamic) Step .Word Document invoice template has been created for this example. We have created Bookmarks in this template everywhere that the template has data in square brackets. In this example , we are going to create a Flow with a Form , where the user will be able to enter information, and then, download the Invoice Template using their Information .  See the Invoice Word Document below (Figure 1).

Invoice Word Document

wordTemplate.png

Example

Begin the designer folder by creating and naming a Flow. In the Flow designer , navigate to the Steps Tab or use the quick add and locate the Create Data Step from Favorite Steps category in the Quick Add Step dialog (Figure 2)***.*** In the Create Data Step under Common Properties and under Data select Show editor to add data definitions. 
2018-08-20_161646.jpg

Add the Data definitionsName and Type. In the drop-down list under Type choose File Data. Next set Doc File underInputs to Constant and add the Invoice Template Document to the Data Definition. 
2018-08-22_115841.jpg

Next, add a Form to the Flow. In the Steps Tab locate Show Form Step under Favorite Steps and Add or drag and drop the step in the Flow designer. Select Show Form in the Flow designer and then choosePick or Create to Create and  Name the Form . For this example, the Form will be given the name Invoice.

]2018-08-22_120103.jpg

This Form is designed as following, it has numerous Labels and TextBoxes , couple DatePickers , and Submit Button . When we finish designing this Form we can save and close Form Designer.
2016-12-19_162538.png

Next, add Replace Bookmark With Text (Dynamic) Step from the All Steps [Catalog] > Data > Documents category in the Quick Add Step dialog to the flow*. Use user inputs on the Form as a Text for the Bookmarks in the Word Document.*
2018-08-22_133146.jpg

Now select Edit Input Mapping Option from this step’s Options . Define the Inputs,bookmark Name, Document File andreplace With Text.
2018-08-22_134036.jpg

In the Mapping Editor , connect DocFile to the documentFile field. Then define bookmarkName field and connect the respective outcome from the Form to the replaceWithText field.

]2016-12-19_163128.png

Navigate to EditOutput Mapping, choose Change Value. Then connect Output to the Contents field of the DocFile (Figure 9). This mapping step will update the Contents of our Word Document . Save and close Mapping Editor.

2016-12-19_163318.png

In the Flow designer , add another Replace Bookmark With Text (Dynamic) Step from the All Steps [Catalog] > Data > Documents category in the Quick Add Step dialog.
2018-08-22_133146-1.jpg

In the Mapping Editor, map data in a similar manner as the previous step. This time we use anotherbookmark Step , and therefore, a different output value from the Form.
2016-12-19_200101.png

The Output configuration for this step is exactly the same as for the previous step.
2016-12-19_200321.png

Because we have eleven different bookmarks in the Invoice Template , ElevenReplace Bookmark With Text (Dynamic) steps from the All Steps [Catalog] > Data > Documents category will be used in the flow . The data for each Replace Bookmark With Tex t will all map in a similar manner usingBookmark Names and User Inputs from the Form . The Output configuration in Mapping Editor is the same for all these steps.
Finally, add another Show Form step from Favorite Steps in the Quick Add Step dialog to create a Download Form. In the resulting window,   Name the Form and select  Create to proceed to the Form designer.
2018-08-22_135308.jpg

This Form has a Title , which is a Label component from the Data category, a Button control from Actions category, and a File Download control from File Handling category. When the Form is complete save the Form and close Form designer.

2016-12-19_203957.png

In the Flow designer connect the Outcome from the Download Form to the End Step in the Flow. Select the Edit Input Mapping for the Form step.
2018-08-23_110149.jpg

In theMapping Editor , map the updated DocFile to the FileHere Download control on the Form (Figure 16) . Then, save and close Mapping Editor.
2016-12-19_204241.png

This completes the Flow design, select Debug Flow on the top action panel of the Flow designer to test the Flow (Figure 17).
2016-12-19_204458.png

The Invoice Form opens in the Debugger . Fill in all required Fields and select Submit.
2016-12-19_204923.png

Next, The Download Invoice Form opens. Select the Download File button.
2016-12-19_205827.png

Next, confirm the Download process. Then Name our File and Save.

2016-12-19_205903.png

Back in the Debugger select Done on the Download Invoice Form.
2016-12-19_210226.png

Locate the New Document file and open it. Confirm that all bookmarks on the Template were changed with user’s inputs .
2016-12-20_085453.png

Was this article helpful?