Del via


Binding document content to Document Information Panel in MOSS2007

Today I will talk about the possibility to bind the content of a Word 2007 document to it Document Information Panel in SharePoint 2007.

This is quite a useful feature as the content of documents can be automatically populated via the metadata and viceversa.

The trick is done by Content Controls.

Let’s create a document library named “To Be Approved”. Let’s add some required columns to this document library. I have added a column named “Approver” (single line of text, required) and another column named “Date Approved” (date time, date only, optional).

Let’s now create a new Word 2007 document from our document library.

Let’s insert a header (I chose the “austere” style formatting) and save the file locally as a docx. This is the most important step as Content Controls are only available in Open XML documents.

Continue editing the header of the file: insert a Quick Part -> Document Properties and choose Approver (our sharepoint column). Do the same for “Date Approved” field.

 

Header

Note that if you modify the value of either Approver or Date Approved fields the content of the document will change accordingly, and vice versa modifying the date in the header the metadata will change.

Now let’s go back to our document library: document Library settings, Advanced Settings: and enable content types.

Click on “Document” under Content Types and go to advanced settings. Check Upload a new document template and browse for the file we just finished editing.

Now go back to our library and click on New: a new docx file will open.

Edit metadata (approver, approved Date, Title), you will see the header updates with the metadata values you’ve just entered.

Note. You can bind any part of a docx file to metadata. I chose a header just for the purpose of demonstration.

Comments

  • Anonymous
    September 02, 2009
    Hi, You would never realise how much you have helped me with this blog!!! It's not the whole blog, but just the QuickParts section that solved my problem!! I was confronted with this issue with a broken sharepoint generated document template that, for some reason was just not behaving as expected. Having never handled sharepoint before, I scraped everything related, but nothing even seemed to mention this quickparts thing! I do applications development, but sharepoint was just not my forté.... No where i looked seemed to document this handy menu in relation to Document Info Panels and Sharepoint! Thanks a lot!