If you want to add RibbonX support to your Word AddIn, it is actually pretty easy.
- Read Patrick Schmid's article on adding IRibbonExtensibility to your IDTExtensibility2 class. Very straightforward.
- Read Eric Faller's article on the code to put in your AddIn to get RibbonX functionality. You mainly want to read Part II.
- Read Frank Rice's and Ken Getz's article on using the Ribbon. This gives you a lot more detail.
- Part 2 (next in TOC) of Frank/Ken's article lists the RibbonX xml schema.
Patrick's article gives you exactly what to do for the shim. However, for a very simple starter program, here is a working example (note WindwardBear is the namespace for my AddIn):
...
[GuidAttribute("3F7440C9-FA66-4424-859D-B49799CCA96A"), ProgId("AutoTag2007.Connect")]
[ComVisible(true)]
public class Connect : Object, IDTExtensibility2, IRibbonExtensibility, IDisposable
{
public string GetCustomUI(string RibbonID)
{
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("WindwardBear.customui.xml");
StreamReader reader = new StreamReader(stream);
return reader.ReadToEnd();
}
public void DoSomething(IRibbonControl button)
{
NativeMethods.TopMostMessageBox(GetParent(), "DoSomething " + button, "AutoTag Ctor", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
...
customui.xml which is in the project root directory and it's build action is "Embedded Resource":
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<officeMenu>
<button id="AutoTag"
label="Auto Tag 1"
onAction="DoSomething"/>
</officeMenu>
<tabs>
<tab id="AutoTagTab"
label="Auto Tag 2"
visible="true">
<group id="EditingTools"
label="Editing Tools">
<button id="ClearTimecard"
label="Clear Timecard"
size="large"
onAction="DoSomething"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Do you find this useful? If so please check out Windward Reports.