Office.Control interface
Represents an individual control or command and the state it should have.
Remarks
For code samples showing how to use a Control
object and its properties, see Change the availability of add-in commands and Create custom contextual tabs.
Requirement set: RibbonAPI 1.1
Examples
// This snippet enables a control (a button) in a custom ribbon tab.
// Note that "MyButton", "OfficeAddinTab1", and "CustomGroup111" are defined in the manifest.
const enableButton = async () => {
const button: Control = { id: "MyButton", enabled: true };
const parentGroup: Group = { id: "CustomGroup111", controls: [button] };
const parentTab: Tab = { id: "OfficeAddinTab1", groups: [parentGroup] };
const ribbonUpdater: RibbonUpdaterData = { tabs: [parentTab] };
Office.ribbon.requestUpdate(ribbonUpdater);
}
Properties
enabled | Indicates whether the control should be enabled or disabled. The default is true. |
id | Identifier of the control as specified in the manifest. |
Property Details
enabled
Indicates whether the control should be enabled or disabled. The default is true.
enabled?: boolean;
Property Value
boolean
id
Identifier of the control as specified in the manifest.
id: string;
Property Value
string