Intelligent Document Templates
I had an email from a colleague asking me how to go about creating a document template where the content of the template contains metadata from the content type's metadata. I thought this was valuable to others as I haven't seen anything posted about this, so I thought I'd write this post to explain how to achieve this.
Upon completion, you will have a two-way template where data entered into a document based on the template will populate the document's metadata. Also, metadata entered into a document's properties panel will auto-populate the document's content.
Imagine we have a content type called "Contract" assigned to a document library and that the content type has the following metadata:
- Contract Number: Number (0 D.P.)
- Contract Date: Date & time (date only)
- Customer Name: Single Line of text
- Contract Duration: Choice (1 year, 3 years, 5 years)
To create an intelligent document template:
- Click the "New" button on the document library to create a new document based on the Contract content type – this will fire up Word 2007 and open a blank document of content type Contract.
- Save the document locally instead of back into SharePoint, say to the desktop.
- Open the "Insert" tab within Word 2007.
- Drop down the "Quick Parts" menu, and open the "Document Properties" sub-menu.
- Here you will see a list of all the properties of the document, including our custom metadata defined above.
- Select the property you are interested in from the menu and a quick part is inserted into the document at the location of the cursor.
- Continue this approach to add additional quick parts, then save the document locally again.
- Open the settings for the Contract content type (Home Site -> Site Actions -> Site Settings -> Modify All Site Settings -> Site content types, then select the "Contract" content type).
- Click on the "Advanced Settings" link for the Contract content type.
- Select the "Upload a new document template" radio button and browse to the file we saved locally.
- Leave the other settings at their default values and select "OK".
- Now go back to the document library where the Contract content type is being used and click the "New" button to create a new document. This new document will be based on the new template and will contain the quick parts that we added previously.
- Completing the metadata in the document properties panel will complete the content in the quick parts in the document's content. Likewise completing the quick parts will populate the document's metadata properties.
Hope this all makes sense . . .