Skip to main content

SpreadsheetControl.AddToolbarToMenuManager(SpreadsheetToolbarType) Method

Adds the specified ribbon tabs/bar groups to the existing ribbon or toolbar menu.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.1.dll

NuGet Package: DevExpress.Win.Spreadsheet

Declaration

public void AddToolbarToMenuManager(
    SpreadsheetToolbarType toolbarType
)

Parameters

Name Type Description
toolbarType SpreadsheetToolbarType

The SpreadsheetToolbarType enumeration members that specify ribbon tabs/toolbars to add to the control.

Remarks

Use the AddToolbarToMenuManager method to add a new tab or bar group to the existing ribbon or toolbar menu. If the SpreadsheetControl doesn’t have a RibbonControl or BarManager associated with it, the InvalidOperationException exception occurs. Use the CreateRibbon or CreateBars method to provide a ribbon or bar UI for the SpreadsheetControl at runtime.

The following code shows how to display a ribbon for the SpreadsheetControl, and use the AddToolbarToMenuManager method to add the Mail Merge tab to the created ribbon:

using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraSpreadsheet;
// ...

public Form1()
{
    InitializeComponent();

    // Create the Spreadsheet's ribbon menu.
    RibbonControl ribbon = spreadsheetControl1.CreateRibbon();
    // Add the Mail Merge tab to the ribbon.
    spreadsheetControl1.AddToolbarToMenuManager(SpreadsheetToolbarType.MailMerge);
    // Specify the active tab.
    ribbon.SelectedPage = ribbon.Pages["Home"];
    this.Controls.Add(ribbon);
}
See Also