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
- Launch Office Word 2007
- File | Open to open any Document Information Panel document
- Place IP in the document where you want the property control to be
- Click Ribbon UI Insert | Quick Parts | Document Property
- 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.
- Launch Microsoft Word 2007
- File | Open to open a document that contains this custom Document Information Panel
- Press Alt+F11 to launch Microsoft Visual Basic editor
- Press Ctrl+G to launch the Immediate window
- In the Immediate window, add a Text content control by triggering the following command:
- 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.
- 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.
Software Design Engineer in Test
Software Design Engineer in Test