Hi, I am using "MS word 2007 doc to Template" smart service


I am using "MS word 2007 doc to Template" smart service to generate the report. I have large number of ###key### in the template. Everything works fine.

But when I make some changes in the template and upload it again, it removes the most of the mappings done previously. I has to do it again and again each time I update the template.

e.g. Even if I modify the alignment of the text and upload the new version of the document, and when I go back to that node and rescan the template, some of the mappings will be lost. (If I run the process model without rescanning or updating the new template in that node, generated report does not replace the ###key### values.

Please advice....



  Discussion posts and replies are publicly visible

  • In order to preserve the original mappings (as long as you haven't changed the name):

    0. Make sure you have saved the most recent changes you've done to your model
    1. Upload a new version of your template by clicking on the checkbox next to the file name in the Documents tab and click "New Version"; complete the wizard.
    2. Open your "MS Word 2007 Doc from Template" node and click on the "Setup" tab
    3. In the "Template" field select your template
    4. Click "Re-scan" template
    5. If the names of the tokens didn't change the expressions you used in the original template will remain as seen in this video forum.appian.com/.../103298
  • Hi Eduardo,

    Thank you for the detail explanation.
    I am following the same steps. And it works perfectly fine for small unformatted templates. But my document has 200+ tokens. When I update the template and follows the same steps you described, some of the mappings gets disappear.

    Even if when I don't add any new token and simply change some formatting in the template, some of the mappings are getting lost.

    And this is not just happing with the single template, I have more than 10 templates and all of them has the same issue.

    Following the same steps doesn't work for me. Is there any alternate way to preserve the mapping?
  • Make sure that you have your spell checking and grammar checking options turned off when you update the files. Also, you'll need to examine your updated templates to ensure that there aren't any partial elements appearing within any of the merge fields. Do this by changing the file format from docx to zip, and opening the document.xml file. For example: the following XML won't work, due to the </w:r> close tag being inside the merge field. <w:rFonts w:ascii="Helvetica" w:hAnsi="Helvetica" w:cs="Helvetica"/><w:t>###</w:t></w:r><w:t> VARIABLE<w:t>###</w:t>
  • Here are the options you need to set in MS Word, to ensure that your merge fields remain unbroken.

    * Start by clicking "File" > "Options". The Word Options dialog is displayed.
    * Click "Proofing" in the left navigation.
    * Clear the "Check spelling as you type" checkbox.
    * Clear the "Mark grammar errors as you type" checkbox.
    * Click "Trust Center" in the left navigation. Select "Trust Center Settings".
    * Clear the "Store random numbers to improve Combine accuracy" checkbox.
  • Keep in mind that you'll still see issues -- even with these settings -- any time there's formatting applied to just part of a merge field, and not the whole merge field.
  • Jim - I understand your point. But that would be time consuming. And if the smart service can load the tokens from the template correctly then it should also reload the mappings. Isn't it?
  • I will consider the point you have described. I will let you know whether it works or not. Thank you for your help.
  • 0
    Certified Lead Developer
    I think Jim is correct - but the real issue is that if you edit the word document (particularly in any way that affects any of your ###key###s), their formatting might be changed in the behind-the-scenes XML code contained in the word doc; and for some reason this trips up the "generate document from template" parser in Appian and it loses the mappings when the "changed" keys are found, even though they're still the same in name and appearance.
  • Hi Jim, I did all settings you mentioned but it didn't worked. And changing the document.xml is not good option to handle large template Although I know it should work.
    Anyway thank you very much for all your help.
  • Even I tried updating the document.xml file. I simply removed bold style for only one token ###status### in my template. But and uploaded the new version. But it didn't worked. It is working the same way as it worked for updating docx file.
    So far I was under impression that changing the document.xml should resolve this issue, but it didn't.
    I had simply removed "<w:b/>" from document.xml and uploaded new version. And it didn't worked.