Customizing Office Ribbon UI:
custom button, group, tab in Outlook, Excel, Word
Add-in Express™ Add-in Express Home > Add-in Express for Office and .NET > Online Guide > Tips and notes > Ribbon HOWTOs Office Ribbon HOWTOs
How to find the Id of a built-in Ribbon controlOpen the Customize the Ribbon tab in the File | Options dialog, hover the mouse cursor over a list item that represents a Ribbon control and pay attention to the tooltip. In the screenshot below, the control caption is Bullets, the control's Id is BulletsGalleryWord. You can find other details in a list of built-in Ribbon controls, see Referring to Built-in Ribbon Controls. How to create a custom Ribbon tabOpen the designer of the add-in module. Click the ADXRibbonTab command in the toolbar at the top of the module (see the screenshot below). Select the newly created component and configure it using the Properties window. How to create a custom Ribbon group on a custom or built-in tabOpen the designer of the add-in module. Put a new ADXRibbonTab component onto the add-in module or select an existing one. To customize a built-in tab, set the IdMso property of the tab component, see Referring to Built-in Ribbon Controls. In the in-place editor, use the toolbar to add a Ribbon group component (ADXRibbonGroup) to the tab (see the screenshot below). Select the newly created component and configure it using the Properties window. How to create a custom Ribbon buttonOpen the designer of the add-in module. Put a new ADXRibbonTab component onto the add-in module or select an existing one. In the in-place editor, select an existing Ribbon group component (ADXRibbonGroup) or create a new one. In the in-place editor, use the toolbar to add a Ribbon button component (ADXRibbonButton) to the group (see the screenshot below). Select the newly created component and configure it using the Properties window. How to add a built-in Ribbon button to a custom groupAdd an ADXRibbonButton component to an ADXRibbonGroup. Specify the Id of the built-in Ribbon button in the ADXRibbonButton.IdMso property. How to select a Ribbon component without using the in-place designerIn the Properties window, select the required component using the dropdown demonstrated in the screenshot below. How to position a custom Ribbon tab/group among built-in tabs/groupsOpen the designer of the add-in module. Select the corresponding Ribbon component and specify the Id of the preceding (following) built-in tab/group in the InsertAfterIdMso (InsertBeforeIdMso) property. How to intercept or disable a built-in Ribbon controlOpen the designer of the add-in module. Select an ADXRibbonCommand component existing on the add-in module or create a new one using the ADXRibbonCommand command in the toolbar at the top of the module (see the screenshot below). Switch to the Properties window and specify the Id of the built-in Ribbon button you want to disable or intercept in the IdMso property of the ADXRibbonCommand component. In the Properties window, choose the appropriate value of the ActionTarget property; for a control type producing no events (e.g. gallery or menu) choose NonActionControl. To intercept the control's event, in the Properties window switch to the Events tab and add an event handler to the OnAction event. In the event handler, add custom code. In particular, you can set e.Cancel=true to cancel the action associated with the Ribbon control. Note that if you set ActionTarget=NonActionControl, the event handler is ignored. To disable the built-in ribbon control, in the Properties window set ADXRibbonCommand.Enabled=false. How to hide a built-in Ribbon tabOpen the designer of the add-in module. Put a new ADXRibbonTab component onto the add-in module or select an existing one. In the Properties window, specify the Id of the built-in tab to be hidden in the ADXRibbonTab.IdMso property. To hide the built-in tab, set the ADXRibbonTab.Visible property to False. How to hide a built-in Ribbon groupOpen the designer of the add-in module. Put a new ADXRibbonTab component onto the add-in module or select an existing one. In the Properties window, set the ADXRibbonTab.IdMso property to the Id of the built-in tab. In the in-place editor, select an existing Ribbon group component or add a new one. In the Properties window set the ADXRibbonGroup.IdMso property to the Id of the built-in group. To hide the built-in group, set the ADXRibbonGroup.Visible property to False. Note, this doesn't hide the built-in group added to the Quick Access Toolbar (QAT). How to activate a custom ribbon tabTo activate a Ribbon tab, call ADXRibbonTab.Activate() at run-time. Note this doesn't work in Office 2007 because it doesn't support that Ribbon API call. |