function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Generate word documents on the fly using merged data

Hi All Is it possible to upload some word document as template on the platform and then generate new documents from merged fields and the uploaded document template?

Check the contentType attribute on the page component per the docs.


Jeff Douglas

Appirio, Inc.


Author: The Salesforce Handbook


Thanks for the reply Jeff..

But I think my problem is a bit different, this is what I want to do


1. Upload some documents as templates using my app on platform

2. Other users of the app can select one of these template and then he will create final document using merged fields from SF CRM

3. So I need to design a mechanism where I can read the selected template and then create a new document on the fly using this document template and the merged fields. The tricky part here will be maintaining the same formatting and structure as that of the template document and insert the merged fields and recreate the document


Any clues on how should I go about it?


Thanks in advance




Thanks Jeff.. I'll take a look at those posts..

Ken FernandesKen Fernandes
Hi Sachin,

I know this is a few years too late but I was wondering if you got the answer to your question above. My requirement is the same as yours, in that, I need to insert some content (from my Contract object) at certain locations into a word document and then spit out the updated word document to the user.

For the most part, I am able to extract the word document that is attached to a contract (in 'Files' section) and allow user to preview or download this file on button click. I am also able to read values tied to various data-points on current contract. 

The only piece of the puzzle that I am missing is the insertion of values for some fields from current contract into the word document. Please advise on this, if possible.