Data binding between Document Information Panel and Word document

The Document Information Panel is a Microsoft Office InfoPath 2007 form that is hosted and displayed in a Microsoft Office Word 2007, Microsoft Office Excel 2007 or Microsoft Office PowerPoint 2007 document. It enables users to view and edit properties of a document or a content type that is associated to a document management server.

In Microsoft Office Word 2007, users can add properties from Document Information Panel as content controls to document surface. This is also known as data binding between Document Information Panel and Word document. Users can bind Document Properties, Server Content Type Properties or Custom Properties. Once the data is successfully bound, users can edit the properties from Word document surface.

This article will demonstrate two ways to bind data from Document Information Panels to Word document surface.

Method 1: Binding Document Properties or Server Content Type Properties to document surface

  1. Launch Office Word 2007
  2. File | Open to open any Document Information Panel document
  3. Place IP in the document where you want the property control to be
  4. Click Ribbon UI Insert | Quick Parts | Document Property
  5. Choose the property you want to add:

You now have a content control in Word surface that binds data to Document Information Panel property. Please note that this method also works for Server Properties, but you need to save or associate the document with the Server document library first. Then you will see Server Properties in Quick Parts | Document Property list.


Method 2: Binding Custom Properties to document surface

For non-document or non-server related properties, which are defined as Custom Properties in this blog, there is no UI to bind these properties directly to document surface. Users need to use Word Object Model to do the data binding.

Assume the Custom Document Information Panel has the following data structure:

Here are the steps to bind the costCenterID property to Word document.

  1. Launch Microsoft Word 2007
  2. File | Open to open a document that contains this custom Document Information Panel
  3. Press Alt+F11 to launch Microsoft Visual Basic editor
  4. Press Ctrl+G to launch the Immediate window
  5. In the Immediate window, add a Text content control by triggering the following command:

ActiveDocument.ContentControls.Add wdContentControlText

  1. Set up this content control XML mapping to costCenterID node by triggering the following command:

ActiveDocument.ContentControls(1).XMLMapping.SetMapping "//*[local-name(.)='costCenterID']",, ActiveDocument.CustomXMLParts(4)

Here the SetMapping function takes three arguments. First input is the XPath of the node you plan to do a mapping.  Second one is PrefixMapping input. Last one is Custom XML Part source where the node belongs to. In this case, costCenterID node lives in 4th custom XML part.

  1. Switch back to Word active document window. The content control should get set up.

Now you have successfully set up properties mapping between Document Information Panel and Word document. When you edit the properties from Word document, the value is updated in the Document Information Panel automatically or vice versa.

If you'd like to know more about the Document Information Panel, be sure to check out this webcast.

Emily Ching
Software Design Engineer in Test

Comments (8)

  1. jmortiz says:

    Hi !, my name is Juan Manuel and i´m implementing documents with custom document information panel´s but I´ve had some problems at the moment to join the infopath form and the document in word, i´m not using MOSS 2007 with content types, jus´t the infopath form and word,

    ¿Do you have some links or examples with the behind programming necessary to make this work?, i really aprecciate it.



  2. says:

    Content Control Toolkit :

    Great tool to map XML to Word

  3. 環境: Office SharePoint Server (MOSS) 2007 SharePoint Designer 2007 こんにちは。 今日は Non-Code です(コアの開発者向ではなく、SharePoint

  4. 環境: Office SharePoint Server (MOSS) 2007 SharePoint Designer 2007 こんにちは。 今日は Non-Code です(コアの開発者向ではなく

  5. Matt says:

    Can I use InfoPath to standardize form input in a PowerPoint Presentation?

  6. P Cleaner says:

    Could only get this to work for 1 custom part. As soon as I introduced a 2nd custom part to content control relationship the binding (of the 2nd CP) wouldn't work.

Skip to main content