Word Document Creation Dynamically, in Sharepoint 2010 1

Though I have been working on SharePoint from past 4+ years, I feel bad that I didn’t notice this awesome feature, We can create / update word documents dynamically in SharePoint. This is a very useful feature which will be helpful in creation of standard word documents like Approval forms / Employee Offer letters etc. It just takes few minutes to setup.

To understand how to create it, lets create one sample document (Employee Offer Letter) using this feature.

I’m implementing this example in Sharepoint 2010. We need Design rights on SharePoint site and also Sharepoint Designer, MS Word  are needed for this example.

Step 1: Create a Document library to generate and store the Offer letter documents in the  site. Create the columns that are dynamically need to be updated in the document, eg: Name, salary etc. The columns in Library acts as properties for a document, which can be added directly in the word document. In this example I added 4 such fields

      1. Employee Name
      2. Salary
      3. Designation
      4. Proposed Joining Date


Step 2: For every Document library we will have a default file template for that library. This can be word document too. To edit it, go to Settings > Advanced Settings . Document template will be available, click on ‘Edit Template’. This opens up MS Word with the standard template file (.dotx)


Step 3: Now, writeup the standard content that to be there in the Offer letter and in the places where data to be filled dynamically i.e. Employee name, salary etc. insert the Document Properties that we created in above steps. To add a document property, Select ‘Insert’ in word ribbon and Go to Quick Parts > Document Properties. All the above created columns are displayed along with default ones. Select corresponding property.


Step 4: Once added , click on Save as and change the format from ‘.dotx’ to ‘.docx’ ( this step is needed to automate document generation, we can’t update a ‘.dotx’ from back-end.) Now the document looks as in below screen.


With above step, we are ready with document library and if we create a new document in this library, it will automatically fill in all the corresponding placeholders and our document is ready.

Step 5: Now, create a document to test it. If you click on ‘New Document’ in the document library, a word document with previously created template opens. Also, a form with all the new fields we created will be displayed on top.


Step 6: If we fill-in the corresponding details,  the place holders will be automatically updated and once you save it, a new document with these details is created in the document library. A sample document will appear as in below screen after filling all details.


To, create this document dynamically, we need to create new item through back end in the library, by filling all the properties we created. This can be achieved in multiple ways. 

I created a list with same details and using a workflow on the list, when a new list item created,  it will create a new item in the document library by filling all corresponding properties in library.

To do this, follow below steps. 

Step 7: Create a Sharepoint list with the same columns we created for library.


Step 8: Open Sharepoint designer and Go to the list we created and click on New workflow. Fill in the Workflow Name, description

Step 9: Select action ‘Create List Item‘ from Actions tab in ribbon


Step 10: Click on ‘this list’ and choose the document library we created.

Step 11: Using ‘Add’ option, choose each column and fill it with the current item corresponding column data. Also, modify default field ‘Path and Name’ with the convention you prefer.


Step 12: Once all the fields are mapped. Save the workflow. And, select the option to ‘Start workflow automatically when item created’ and publish it. I also added another step to send email with the newly created document link.

With these steps we completed our configuration / development process for the functionality.

To test it, create a new item in the list with  all the details. Then, open our document library to see the newly created document with the details.

This feature not only automates document creation, but also helps us in logging the details in online system which will be helpful for future references / audit purposes.

For any queries – Leave them in the comments below. And if you found this useful – let us know how.



One comment on “Word Document Creation Dynamically, in Sharepoint 2010

  1. Reply Anonymous Aug 29,2015 9:11 am

    Cool tip! Easy reading and thanks for sharing.

Leave a Reply