Office.Group interface
Represents a group of controls on a ribbon tab.
Requirement set: RibbonApi 1.1
Remarks
Used by
Examples
/**
* Shows or hides a contextual tab.
*/
async function setContextualTabVisibility(visible: boolean) {
// Define a tab group of controls.
const group: Office.Group = {
id: "TableToolsGroup",
controls: [
// The controls of the group...
],
};
// Update the ribbon to show or hide a tab with the specified group of controls.
await Office.ribbon.requestUpdate({
tabs: [
{
id: "contextTab1",
visible: visible,
groups: [group],
},
],
});
}
Properties
| controls | Specifies one or more of the controls in the group, such as menu items, buttons, etc. |
| id | Identifier of the group as specified in the manifest. |
| visible | Specifies whether the group of controls is shown or hidden on a custom tab. |
Property Details
controls
Specifies one or more of the controls in the group, such as menu items, buttons, etc.
controls?: Control[];
Property Value
Remarks
When the Group object is part of an Office.RibbonUpdaterData object passed to the requestUpdate method of Office.Ribbon, the controls properties of the various Office.Group objects specify which controls have their enabled status changed; the controls property of the Group object's parent Tab object is ignored.
id
Identifier of the group as specified in the manifest.
id: string;
Property Value
string
visible
Specifies whether the group of controls is shown or hidden on a custom tab.
visible?: boolean;
Property Value
boolean
Remarks
Requirement set: RibbonApi 1.3
Examples
// Hide the Reporting Group from the User Tools tab on the ribbon.
const group: Office.Group = {
id: "Contoso.ReportingGroup",
visible: false
};
const tab: Office.Tab = {
id: "Contoso.UserToolsTab",
groups: [group]
};
// Apply the change to the ribbon.
const ribbonUpdater: Office.RibbonUpdaterData = { tabs: [tab] };
await Office.ribbon.requestUpdate(ribbonUpdater);