Step 4: Rename and Open the Document
Your customization work is done, so close the container and then rename the file to remove the .zip extension. The next time you open the document, the application parses the custom XML file and displays the new Ribbon elements.
The process of creating callbacks, generating custom XML, and adding new interface parts to document packages is so time consuming and finicky that I predict there will be a booming market in Ribbon interface editors. As I write this, there is one editor available via the OpenXML Developer site: the Microsoft Office 2007 Custom UI Editor.With this nice little utility, you open the macroenabled Office document or template, and then use the Custom UI tab (essentially a large edit box) to add your custom XML code.A Validate button on the toolbar lets you know whether your code is well formed.When you save the file, the editor adds the XML to the document package and updates the .rels file. It even comes with a Generate Callbacks button that adds the stub procedures for the callback macros to your document.
If you do use the Custom UI Editor discussed in the preceding Tip, never open a document in the Editor and in its Office application at the same time.A bug in the Custom UI Editor (possibly resolved by the time you read this, but you never know) causes the editor to strip out some or all of the document's existing macros.
In this tutorial:
- Customizing the Office 2007 Ribbon
- Understanding Ribbon Extensibility
- Extending the Ribbon: An Example
- Step 1: Create a Macro-Enabled Office Document or Template
- Step 2: Create a Text File and Add the Custom XML Markup
- Step 3: Copy the Custom XML Markup File to the Document Package
- Step 4: Rename and Open the Document
- Hiding the Built-In Ribbon
- Creating Custom Tabs
- Customizing an Existing Tab
- Creating Custom Groups
- Customizing an Existing Group