I can’t take all the credit for this post, it is a combination of knowledge gleaned from 3 different posts (see references at the end of the post) and some playing around on my part.

To start with, a little background.  The environment I created this in is SharePoint 2010 Enterprise (no InfoPath forms services).  We needed to be able to allow users to add/update items in a SharePoint list and from that list item generate a document that could be be submitted (emailed or faxed) to the proper parties.  So, how did we do it?  A standard SharePoint List, a custom SharePoint Designer Workflow and a custom Word Document template on a document library.

The first thing to do is to create your Word Document.  That simple, just open up Word 2010, create a document and save it as a .docx file (I tried .dotx initially but had some issues).  Then upload this to the Forms folder in your SharePoint document library.  Once this has ben uploaded, go the advanced settings within your document library settings.  Type (or paste) in the relative URL to your uploaded Word document (i.e. DocLib/Forms/mydoc.docx).  After this has been filled in, click Edit Template directly under the text box.  This should open your Document.  Switch to the Insert tab in the ribbon, click Quick Parts, hover over Document Property, and you should see all the metadata properties (list columns) from your SharePoint Document Library.  At this point in time, feel free to go back to your SharePoint document library and add any additional columns you may need.  Note: I initially tried the above process using Content Types and didn’t get the same results.  My custom columns weren’t showing up in the Quick Parts.  Not to say it isn’t possible and I won’t try to figure it out, I just didn’t spend the time on it for my quick prototype.

So, now every time you create a new document in the library, it will pull that documents metadata and insert it into the appropriate controls within the document.  But, what if a field isn’t required and sometimes come back blank?  If you try to print the document, you get [Field Name] for all blank fields.  Not exactly what I hoped for.  Good thing is, it’s easy to fix.  For more details, pics around this process, see the third reference below.  Quickly, the process is:

  1. Add the Developer Toolbar to the Ribbon
  2. Select the Developer Tab
  3. Click on Design Mode
  4. Where you have the [FieldName] Text in your controls, replace it with a space (you can’t leave it completely empty)
  5. Now when you open your document, any blank field will just be a single space

Finally, the good stuff, you have a document, you can auto populate fields in the document from the metadata, but how do you get that metadata there and auto generate the document from a list item?


For this, just start by reading the List fields + Workflow = controlled Word document reference below and skip down to Step 3.  (1 and 2 are just restating what I have above).  But don’t do too much yet.  One that that is mentioned in Step 3 is that your custom list and create the same columns as you did for your Document Library.  You actually don’t have to do this.  For instance…I have several choice fields in my custom list.  For arguments sake, lets say with 4 items.  In my document library, I have one column for each possible choice (4 single text fields) because I want to fill in certain text in my document based on the choice made.  This also included the use of several Workflow variables.

Ok, now go ahead and start your custom list and workflow.

This should give you a good starting point, feel free to get creative with the workflow.  I actually added an approval into my workflow so that unless the add/update of the item in my custom list is approved, the document won’t be generated.

I also made extensive use of Workflow Variables, in some cased, combining fields from my custom list into a single variable to then place that variable within a field on my Word document.  You can also put conditions within the workflow, one of mine was, if the Workflow was started by updating a list item, put update as part of the name of my word document.  If the workflow was started by creating a new list item, put new as part of the name of the document.  Be creative!! As always, if you have any questions, comments in sites or creative things you’ve done with Word documents, workflows, and metadata, feel free to leave a comment below.


XML mapping with Word & SharePoint – http://sharepointben/s.office.com/b/microsoft-word/archive/2007/01/18/xml-mapping-with-word-sharepoint.aspx

List fields + Workflow = controlled Word document – http://sharepoint-afterwork.com/2010/10/14/list-fields-workflow-controled-word-document/

Configure Word 2007 Content Control with empty Placeholder Text – http://www.moss2007.be/sharepointben/s/vandest/archive/2009/12/03/configure-word-2007-content-controls-with-empty-placeholder-text.aspx (This also work for Word 2010)