When a custom Document Information Panel is associated with an Office document and/or template, the information needed to locate the Panel is contained in a custom XML data part stored with the document.
I won’t go into the details of the way an Office Open XML document is structured here (needless to say there are many great resources for this on the web), but the format is basically a ZIP file with a collection of XML files that describe the contents of the word processing, spreadsheet, or presentation. Those XML files are linked to each other via logical “relationships” that define the necessary semantics (e.g. that one file contains the content for the header).
In the terms familiar to the Office Open specification, a custom XML data part is stored at the following location in an Office Open XML document:
- Source part: the document (in WordprocessingML); the workbook (in SpreadsheetML); the presentation (in PresentationML)
- Source relationship: http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml
- Content type: application/xml
Basically, the data is stored in an XML file which is logically related to the main part for that file type, and whose logical relationship is of type “customXml”.
Now then, the other half of the definition of a custom Document Information Panel is the content of that custom XML data part. Here’s an example of the data stored in the custom XML data part for a custom Document Information Panel:
This part defines the settings for the Document Information Panel by using the following four elements:
|showOnOpen||This element specifies whether the Document Information Panel should automatically be displayed when the document is opened and the first time it is saved.|
|defaultPropertyEditor||This element specifies which Document Information Panel template should be shown first when the Panel is made visible (either automatically or by the user).
The contents of this element are one of two choices:
|XMLNamespace||The root XML namespace of the custom Document Information Panel. If this template is the one which should be shown automatically, this value is the same as the value of the defaultPropertyEditor element.|
|XSNLocation||The location of the InfoPath form template to be shown in the Document Information Panel. This location can be of either of the following forms:
• File path to the InfoPath form template.
• The URN of the form template if it is a template installed on the target computer.
With that information defined, Office automatically locates a custom Document Information Panel and displays it as requested. Note that none of these steps involve using Office to set up the Document Information Panel – this process can be automated without Office (for example, to add a Document Information Panel to a template as part of a server-based process).