CommandBar
This topic describes the methods and properties of the CommandBar object.
Methods
CommandBars(CommandBarId).Execute()
Controls the manner in which a component responds to clicks. The following example shows how to make a drop-down menu appear when the MoreMenus component is clicked.
-
Demonstration
-
Before the click: The target button is the more menu (represented by a three-line icon) in the top-left corner of the web editor's toolbar.
-
After the click: The button expands a drop-down menu that contains seven options: export as PDF, export as image, save version, version history, collaboration history, rename, and print.
-
-
Syntax
expression.CommandBars(CommandBarId).Execute()The expression is the application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the CommandBars object for the more menu. const moreMenus = await app.CommandBars('MoreMenus'); // Trigger the event after 3000 ms. setTimeout( async () => { // Click the more menu. await moreMenus.Execute(); }, 3000); }
Properties
CommandBars(CommandBarId).Enabled
Disables or enables a component. The following example shows how to disable the MoreMenus component.
-
Demonstration
-
Disabled button (grayed out): On the toolbar, components such as the Start button, the format buttons (B, I, U, and S), the Font drop-down list, and the Font Size drop-down list are disabled.
-
The View Switch button (the three-line icon) in the upper-left corner of the toolbar is enabled.
-
CommandBars(CommandBarId).Visible
Shows or hides a component. The following example shows how to hide the MoreMenus component.
Demonstration
Hide the component

Show the component

Syntax
expression.CommandBars(CommandBarId).Visibleexpression: the document type application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the More Menu button for page customization. const moreMenus = await app.CommandBars('MoreMenus'); // Hide the More Menu button. moreMenus.Visible = false; // Obtain the status of the More Menu button. const visible = await moreMenus.Visible; console.log(visible); }