Populate a MS word mail merge template

Populate a MS word mail merge template

Comments

  • Hi,

    Is it possible for a DB connected datagrid in decisions to populate a MS word mail merge template and generate a PDF version of the mail merge?

    Thanks

  • Hi,

    You can populate an MS Word mail merge template based on data grid output and then convert word document to pdf. I attached an example project. In my example, I used account data in Decisions as input and used Replace Text In Word Document step to modify constant template word document. This step basically helps you to replace defined texts in the template document. In order to link your data grid output into Replace Text In Word Document step, you first need to define Bookmarks on your template word file. After defining bookmarks you can link them to data grid output. In my example bookmarked texts are AccountID and EmailAddress. Please check this document for details.

    After replacing bookmarks data in word document Convert Document step will change the word document to pdf. If you want you can add a download or send email steps according to your need. Also, you can use For Each step to automate a bulk process.

    Please check the attached example and screenshots. If you have any questions please let me know.

    [img]att5[/img]

    [img]att4[/img]

    [img]att3[/img]

    [img]att2[/img]
    [i]edited by kenan@decisions.com on 8/22/2019[/i]

  • This works great for a super simple word document - has anyone ever done it with a more complicated document? I have a template provided by another department that includes tables to organize the areas of the document - the cells are what I am attempting to put the mergefields/bookmarks into so that Decisions can populate those cells with flow data.

    However, The Replace Values in Word Template step continues to fail with the following:

    OutputDocumentFile: "Unable to cast object of type DocumentFormat.OpenXml.Wordprocessing.TableCell to type DocumentFormat.OpenXml.Wordprocessing.Paragraph.

    Has anyone else run into this or come up with a work around?

  • Hello,
    This issue may be too complicated to include in one forum post, for this reason Ive gone ahead and submitted a support ticket so we can take a more in depth look at the issue.

Sign In or Register to comment.