first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Word 2007 Fluent Ribbon: “Ahem… but I am actually customizing Word 2007…”

And to further contradict my previous rants, it is possible to write a macro to load Word Document Parts. However, none of these contradictions hold comfortable solutions. First, you can see the XML file, customUI.xml, in my Normal.dotm template. All I had to do was to edit this file to customize the Word 2007 “Fluent” Ribbon. This is what I did:

  1. Use the Custom UI Editor Tool to generate the proper OpenXML parts in the Normal.dotm template to get me started writing raw XML against the Word 2007 application. I could have done this by hand using the tool mentioned in step 2 but was too “lazy.”

  2. Use the Open XML Package Editor in the VSTO 2008 Power Tools to write raw XML. Doing this in Visual Studio was easier on my eyes (larger, bolder fonts than the Custom UI Editor Tool) and I could use the customUI.xsd schema (in 2007 Office System: XML Schema Reference) to make writing faster (Intellisense support). Also I found out the hard way that it is better to write this XML in a separate file in case Word panics and auto-magically deletes all of my hard work! Visual Studio is a great XML file editor.

  3. Use the 2007 Office System Document: Lists of Control IDs to wade through the sea of “Fluent” fluxions. Utterly ridiculous but it helped.

Okay: and now the macro thing. This is the important call in the important line of code that makes loading Quick Parts (or Custom Quick Parts) automatable: Call Application.NormalTemplate.BuildingBlockEntries.Add(). So what’s my problem? The problem is that a Range containing my custom XML does not get saved properly. Sometimes elements named “unknown” come out from the Quick Part Gallery. You don’t understand what I am talking about? I can sympathize. It would take days upon days to explain to a Microsoft employee—even one on the Word 2007 team—what the hell I am talking about… My guess is that this “edge case” will be fixed by accident in a future release.

[http://kintespace.com/rasxlog/?p=928]

mod date: 2009-08-28T17:31:54.000Z