Replacing Bookmarks With Text (Dynamic)Last Updated: 07/19/2016 Introduced in Verision: 2.0
This tutorial shows how to replace Bookmarks in Word Document with desirable Text. Replace Bookmark With Text (Dynamic) step that we will use for our purposes can be found in Data > Documents category in the Toolbox.
For this Example we have a Word Document that is a Template for an Invoice. We have created Bookmarks in this template everywhere where template has Data in square brackets. In this Example we are going to create a Flow with a Form, where user will be able to enter information, and then, download Invoice Template with his or her Info. Our Word Document looks as following…
We begin in the Designer Folder with clicking Create Flow from Folder Actions panel.
Then, we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add Create Data step from Favorite Steps category in the Flow Designer Wizard.
In the resulting Data Definitions pop-up window we click Add New link.
Next, in the Add DataDefinitions window we Name our Data and define its Type FileData. Then, click Ok to save and close.
Back in the Data Definitions window we click Add to continue…
Next, we select Create Data step on the workspace and Step Information Layer pops up. We use Value picker for our Constant DocFile in the Inputs section to add our Invoice Template Document to the Data Definition.
Next, we will create a Form for user inputs. We add Show Form step from Favorite Steps in the Flow Designer Wizard.
In the resulting window we Name our Form and click Create to proceed to the Form Designer…
This Form 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.
Next, we will use user inputs on the Form as a Text for the Bookmarks in the Word Document. We add Replace Bookmark With Text (Dynamic) step from the All Steps [Catalog] > Data > Documents category in the Flow Designer Wizard.
Next, we select Show Mapping Editor Option from this step’s Options.
In the Mapping Editor we connect our DocFile to the documentFile field. Then we define bookmarkName field, and connect respective outcome from the Form to the replaceWithText field.
Next, for the Output type we choose Change Value.
Then we connect Output to the Contents field of the DocFile. In this manner we will be updating the Contents of our Word Document. Save and close Mapping Editor.
Back in the Flow Designer we add another Replace Bookmark With Text (Dynamic) step from the All Steps [Catalog] > Data > Documents category in the Flow Designer Wizard.
In the Mapping Editor we map data in the similar manner we did it for the previous step. This time we use different bookmark, and therefore, different output value from the Form.
The Output configuration for this step is exactly the same as for the previous step.
Because we have 11 different bookmarks in our Invoice Template, we add 11 Replace Bookmark With Text (Dynamic) steps from the All Steps [Catalog] > Data > Documents category in the Flow Designer Wizard. Also, we map Data for these steps in similar manner using Bookmark Names and User Inputs from the Form. The Output configuration in Mapping Editor is the same for all these steps.
Finally, we add another Show Form step from Favorite Steps in the Flow Designer Wizard to create a Download Form.
In the resulting window we Name the Form and click Create to proceed to the Form Designer.
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 finished, we save the Form and close Form Designer.
Back in the Flow Designer we connect the Outcome from our Download Form to the End Step in our Flow, and call Mapping Editor for the Form step.
In the Mapping Editor we simply map our updated DocFile to the FileHere Download control on the Form. Then, save and close Mapping Editor.
This completes our Flow design. We can click Debug Flow link on the top panel of the Flow Designer to test our Flow.
Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access the Debugger.
Our Invoice Form opens in the Debugger. We fill in all required Fields and click Submit…
Next, Download Invoice Form opens. We click Download File control…
Next, we confirm Download process. Then Name our File and Save.
Back in the Debugger we click Done on the Download Invoice Form.
We locate our New Document file and open it. Confirm that all bookmarks on the Template were changed with user’s inputs.