RibbonCustomizer™
Customize your Office 2007 Ribbon (Office Fluent™)with only a few mouse clicks! Works with Microsoft® Access™, Excel®, Outlook®, PowerPoint® and Word 2007.

Buy for $29.99

Download free Starter Edition

Subscribe | Subscribe by Email |

Categories

Archive


Developer: Overview of the new UI customization model (”RibbonX”)

May 31st, 2006 by Patrick Schmid

Archival Notice: This post is no longer current and has been moved to the archive. Please read the new post replacing this one. Images and links in this post are not guaranteed to work.


After highlighting in a previous post the lack of user customization, it is time to look at customization from a developer’s point of view. If you are interested in background reading on the topic or want a look ahead, read the UI blog on developer topics.Office 2007’s Ribbon opens a new chapter for all Office and Windows developers. Except if you have done some Java UI development, you probably will have never encountered the UI programming methodology adopted by Office 2007. Most Office and Windows developers are used to programming the User Interface directly in their code: Whether it is Office, ATL, MFC or .NET’s Windows Forms, a developer always works with an object model that builds or modifies the user interface. For the Ribbon, there is no object model and the UI is not modified/specified with code.

The following SmartArt graphic outlines the process in which the Ribbon UI can be customized:

I admit the graphic looks rather simplistic, but I had trouble with creating a more complex one with graphics. Let me look at each of these steps in detail.

RibbonX code is XML code following an XML Schema provided by Microsoft. According to Wikipedia, “XML is a way of describing data and an XML file can contain the data too”. For the purposes of customizing the Office Ribbon UI, the XML code describes everything. All the information about size, location, visibility, label, ID, etc that developers are accustomed to specifying in code are specified in the RibbonX XML format. If you are totally unfamiliar with XML or its “relative” HTML, take a look at this XML Tutorial. I will showcase the particular syntax of RibbonX in subsequent posts and also show lots of examples.

The Ribbon Application of your choice (Access, Excel, Outlook, PowerPoint or Word) will read your RibbonX code and apply everything you specified in there to its own UI. A big catch with this is that you only get ONE chance to provide your RibbonX code. That means contrary to the usual Office and Windows UI development, the UI you can specify is rather static during the runtime of your add-in. This is a serious limitation compared to add-in development for previous Office versions. Some dynamic functionality is possible though and I will explore these in subsequent posts. When your add-in is unloaded, all the UI modifications you provided via RibbonX will be removed as well. In previous Office versions, a developer had to make sure to remove these things themselves, but Office 2007 takes care of that now.

The last piece in the new customization model is the actual add-in. In the RibbonX code, you specify “callbacks”. Callbacks are functions in your add-in code that Office calls under certain conditions. For example, you can specify a callback that is called by Office when it wants to know whether a particular control is visible or not. You could also specify a callback to have Office get the label for a control. Callbacks are the most important building block for dynamic behavior and adjustment to different localities.

My next posts will show you how to add a “Hello World” button to the first tab of a Ribbon application and show a message box with “Hello World” when you click on it. Each post will focus on different programming languages and situations from which you can do this.

User: RibbonCustomizer Add-In: Overview

May 31st, 2006 by Patrick Schmid

I wanted to spend some time discussing the RibbonCustomizer Add-In I showed in my last user post. The goal of the add-in is to allow any user to modify his or her own ribbon to better suit his or her needs.

As you can see from the screenshot, the add-in installs itself on the View tab for Excel. It blends in with the ribbon itself and a user won’t be able to distinguish it from any command in Office. However, once the button “Customize Ribbon” is clicked, the add-in informs the user that it is just that, an add-in. It is good style to tell a user that he or she is working with an add-in and not a built-in function, because a user will always first blame Office otherwise if something doesn’t work, even if it is something with an add-in.

I chose to use one large menu button for my add-in in order to use the least amount of space on the ribbon possible. The option to “Show/Hide Customization” allows one to disable or enable all customizations quickly.

Customization Schemes is a concept born out of my pet-peeve “eye candy” WordArt Styles. The idea is to have certain customizations that can be downloaded from the Internet that are geared to achieving one particular thing. For example, there might be a customization scheme to replace the WordArt Styles with the text formatting tools. There might be another one to change the Charting Tabs into ones that are better geared to power users than the ones in Beta 2. A user can install these customization schemes separately, but have them all applied at once (or determine individually which ones to apply and which ones not).

When you click Customize, the following window opens

This window allows a user to change things around with tabs and groups. The right hand side displays the ribbon as provided by Microsoft. The left hand side displays the current customization (as stored in the file. The add-in does not actually query the current ribbon. Why is a topic reserved for the developer section). Tabs can be reordered, removed or added from the MS tab list. Groups for individual tabs can be reordered (partially), removed or added from a list of MS groups.

This functionality allows one to rearrange tabs and groups. As groups are the fundamental buildings blocks of the Office 2007 Ribbon UI, being able to customize them should fulfill the needs of a lot of users.

What do you think? Post a comment and let me know what you think about the add-in and what other features you would like to see!

Developer (advanced): Triggering a tab switch

May 27th, 2006 by Patrick Schmid

Microsoft didn’t outfit Office 2007 with an Object Model to access the Ribbon. As developers, we are very limited in what you can do with the Ribbon. One of the things we cannot do for example is to switch a tab. Only the user (or Office itself) can control which tab is currently displayed on the Ribbon. As developers though we might encounter situations where we really want the user to have automatically a particular tab active on the Ribbon. One such example is if we want to build our own custom contextual tabs.

As Microsoft didn’t provide developers with the means to do this, we need to use a workaround: The add-in needs to pretend that it is the user and send the keystrokes to switch a tab to the Office application. What are these keystrokes? As an example, I will show you how to switch to the View tab in Word.

If you open Word and press and release ALT, it will show you the KeyTips. From the KeyTips, you can see that the View tab is triggered by ALT-W. If you press W then, you will see that Word switches to the View tab, but that the KeyTips are still displayed. To make them disapear, you can either press ESC twice or F6 once. From this example, we know that we need to send ALT-W followed by F6 to Word to switch to the View Tab.

In C# and VB.NET, we can accomplish this with the following line:

System.Windows.Forms.SendKeys.SendWait("%W{F6}");

% represents the ALT key in this example. To send F6 and not the characters F and 6, we need to enclose it in {}. We should use SendWait() instead of Send(), because we might have other commands we want to execute after the keystrokes have been sent to Word. SendWait will make our application wait until the keystrokes have been sent to Word instead of continuing right away no matter whether they were already sent to Word or not. In order for this to work, we need to make sure that System.Windows.Forms is in the References of the project.

In VB6 and VBA, the following line achieves the same:

SendKeys "%W{F6}", True

Let me know how this works for you! In a later post, I will expand on how we can use this trick to construct our own contextual tab.

Subscribing to this blog via RSS from Outlook 2007 Beta 2

May 26th, 2006 by Patrick Schmid

Archival Notice: This post is no longer current and has been moved to the archive. Images and links in this post are not guaranteed to work.


I managed to fix my RSS issues. You can now use the links on the bottom of this page to subscribe to this blog via RSS.

If you are using Outlook 2007 Beta 2, the links won’t work (I presume due to a bug). You need to manually add the feeds:

  • Blog: http://pschmid.net/blog/feed/
  • Comments: http://pschmid.net/blog/comments/feed/

I hope everyone is now able to follow this blog via RSS. If you are still having issues, please post a comment to this post and I’ll get it fixed.

Developer: MSDN Ribbon Developer Portal

May 24th, 2006 by Patrick Schmid

Microsoft launched the MSDN Ribbon Developer Portal! It provides all the resources one needs to develop with RibbonX in one place.

Next Page »