Automate Document Creation using Microsoft Word Connector
    • Dark
      Light
    • PDF

    Automate Document Creation using Microsoft Word Connector

    • Dark
      Light
    • PDF

    Article Summary

    #ServerlessTips - Azure Logic Apps
    Author: Kent Weare Integration MVP

    Azure Logic Apps has traditionally been used to collect data and integrate systems that require this information. These systems may reside in the same organization or organizations spread out across the globe. However, a new capability has been recently released that allows documents to be created through Azure Logic Apps using the new Microsoft Word Connector.

    This new document creation capability provides opportunities to generate contracts and agreements without needing to copy and paste information into Microsoft Word or rely upon expensive third-party tools.

    In this tip, we will take data from Azure SQL and use it to populate a Word Document using the following steps:

    Create all the necessary content for your document

    1-worddoc

    Enable Developer tools in Microsoft Word by clicking on File – OptionsCustomize Ribbon and then check-on Developer.

    2-DeveloperTools

    For each field that you want to populate add a Plain Text Content Control from the Developer menu.

    plain-text

    Also, ensure that you edit the Properties for each text control so that you can provide a descriptive name which will help when mapping data attributes in the Logic Apps designer.

    4-properties

    Repeat these steps for remaining fields and save to One Drive for Business.

    Note: You do not need to save it as a Microsoft Word template. Just save it as a regular ‘.docx’.

    5-finaldoc

    With our Word document in place, let’s now shift gears over to the Azure Portal where we will build our Logic App. Our Logic App consists of a Recurrence trigger followed by an Execute SQL query action that will retrieve customer records from our database. We now need to add the Microsoft Word connector and use the Populate a Microsoft Word template action. Within this action, we need to configure where our Microsoft Word document exists within our One Drive for Business folders. We can now map all of the fields that we previously created within our Word Document.

    The output of the Populate a Microsoft Word template action is a word document. But we need to write this content out, in order to use it. We will use the Create file action found in the One Drive for Business connector to accomplish this.

    6-logicapp

    Testing

    We are now ready to test our logic app by invoking our trigger. When our logic app completes running, we need to check our One Drive for Business folder to find our newly created file. When we open it, we will discover our template has been populated.

    7-testing

    Logic Apps-1

    Conclusion

    In this post, we discussed a new feature available in Azure Logic Apps that allows you to use a Microsoft Word document as a template and then send data from Logic Apps. Considering that Azure Logic Apps has access to more than 230 connectors, this becomes a very powerful scenario as you can now merge data to many data sources, or a combination of data sources, that Microsoft Word previously never had access to.


    Was this article helpful?