MS-Excel / General Formatting

Step 3: Copy the Custom XML Markup File to the Document Package

You're now ready to take the custom XML markup file that you created in step 2 and add it to the document package. Begin by renaming the document or template so that you add .zip to the end of the filename. When Windows asks you to confirm the extension change, click Yes. You can now click and drag the custom XML file and then drop it on the zip container to add it to the document package.

At this point, the custom XML is in the package, but the Office application doesn't know what to do with it. You now need to define a relationship that points the Office application to the new XML part. Open the zip container and then open the _rels folder. You need to get the .rels file out of the container so that you can edit it, and then return it when you're finished. Here's one method that takes advantage of the fact that you have the document package in its own folder:

  1. Right-click the .rels file and then click Copy.
  2. Return to the folder that contains the document package.
  3. Right-click the folder and then click Paste.
  4. Right-click the copy of the .rels file and then click Edit to open it in Notepad.
  5. Make your edits (as described after these steps), save the file, and then exit Notepad.
  6. Right-click the copy of the .rels file and then click Copy.
  7. Open the zip container and then open the _rels folder.
  8. Right-click the folder and then click Paste.
  9. When Windows asks you to confirm, click Copy and Replace (in Vista) or Yes (in XP).

When you have the .rels file open for editing, you need to add a new <Relationship> element that points to your custom XML file in the container. Insert this element between the <Relationships> and </Relationships> elements, but not within any existing <Relationship> elements. Here's the general format:

<Relationship
Id="ID"
Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"
Target="CustomXMLFile"/>
ID
A string identifier that's unique in the .rels file.

CustomXMLFile
The name of the file that contains the custom XML markup.

Here's an example:

<Relationship
Id="MyRibbonID"
Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"
Target="MyRibbon.xml"/>
[Previous] [Contents] [Next]