Can anybody kindly help me to understand how to use the Word upload function in the Print/Merge window?

I have tried to insert the CiviCRM tokens into the Word file before uploading the file and doing the Print/merge -> does not associate all tokens to the values from the database.

I have tried create a Message Template with a Word uploaded file, then to go to the Print/Merge function -> does not associate all tokens to the values from the database either.

Therefore my questions: how should the tokens be inserted into the Word file before doing the upload? Is there any special code that needs to be used? If anybody can provide User-feedback after using this function, I will be very grateful.

Thanks for your help.

(Drupal 7.67 & Civi 5.7.0)

(this is a more precise question, following the question and the answers from last week in Stackexchange : How do use upload function for mail merge with Word)


Which of the various Print/Merge windows are you using - ie what steps do you take to get to that window? (Similar-looking print/merge windows use different code so the functionality is not consistent.)

It sounds like you are doing the right thing - ie create a Word doc with the tokens and upload it.

Do you mean that some of the tokens work, or none at all? If so, which ones do and don't work? It depends on the context as to which tokens are available so I'd start by creating a simple test using the on-screen composer to check that the tokens are being evaluated correctly in that context. If they don't work there, they won't work in a document.

Be aware that the functionality with documents can produce poor results if there is complex formatting since the document is converted to html and so depends on the capability of the conversion library. You might find that converting to ODT produces better - or worse - results compared to DOCX.

In a recent project, we concluded the best option was to do the conversion to html outside of Civi and paste it into the on-screen composer window using the 'Source' button.

  • There is a helpful website called word2cleanhtml.com which you could use if you do what Aidan describes in the last paragraph - which is the approach I would recommend. – Andy Clark Nov 18 '19 at 9:24

Here's what I did that worked for me:

  1. Created an MS Word doc that just had this in it: Hello, {contact.display_name}
  2. Did a Find Contacts search.
  3. Selected a couple contacts.
  4. Chose Print/Merge Document from the Actions dropdown.
  5. Beside "Use Template" I clicked the browse button and uploaded my Word doc.
  6. Entered an Activity Subject.
  7. Chose "MS Word" as the output document type near the bottom.
  8. Clicked "Download Document".

The resulting document had the display names of the selected contacts one per page.

If that doesn't work for you then perhaps you can give more info about what you have in your MS Word document that you are uploading or if the steps you're doing are any different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.