Skip to main content
All docs
V25.2
  • Customize the Spreadsheet Editors

    • 2 minutes to read

    Note

    XAF does not support the Spreadsheet editor for ASP.NET Core Blazor applications.

    In the Model Editor

    This section shows how to use the Model Editor to customize the Spreadsheet Property Editor in a WinForms project.

    Show or Hide the Formula Bar

    The SpreadsheetPropertyEditor displays the Spreadsheet control with a Formula Bar (WinForms).

    In the Model Editor, navigate to the Views | <DetailView> | Items | <PropertyEditor> node and specify the EnableFormulaBar property to show or hide the Formula Bar.

    Formula Bar

    Specify MenuManagerType for a Detail View

    Note that the SpreadsheetPropertyEditor menu manager contains a Ribbon Control or Barsd.

    Navigate to the Views | <DetailView> | Items | <PropertyEditor> node and set the editor’s MenuManagerType.

    MenuManagerType property in Model Editor

    In Code

    Change the Document Storage Format

    1. In the WinForms application project and ASP.NET Web Forms Module project, create a View Controller.

    2. In the overridden OnActivated method, access the SpreadsheetPropertyEditor as described in the Ways to Access UI Elements and Their Controls topic.

    3. Specify the editor’s DocumentFormat property.

      using DevExpress.ExpressApp;
      using DevExpress.ExpressApp.Office.Win;
      using DevExpress.Spreadsheet;
      // ...
      public class SpreadsheetDocumentFormatController : ObjectViewController<DetailView, Document> {
          protected override void OnActivated() {
              base.OnActivated();
              SpreadsheetPropertyEditor spreadsheetPropertyEditor = View.FindItem("Data") as SpreadsheetPropertyEditor;
              if (spreadsheetPropertyEditor != null) {
                  spreadsheetPropertyEditor.DocumentFormat = DocumentFormat.OpenXml;
              }
          }
      }
      

    Customize the WinForms SpreadsheetPropertyEditor Menu

    The SpreadsheetPropertyEditor menu does not display all available toolbars and ribbon tabs. Use the static SpreadsheetPropertyEditor.DefaultSpreadsheetToolbarType property to customize toolbars. The available items are listed in the SpreadsheetToolbarType enumeration.

    using DevExpress.ExpressApp.Office.Win;
    using DevExpress.XtraSpreadsheet;
    // ...
    SpreadsheetPropertyEditor.DefaultSpreadsheetToolbarType |= 
        SpreadsheetToolbarType.ChartTools | SpreadsheetToolbarType.TableTools;
    

    Handle the SpreadsheetMenuManagerController.CustomizeSpreadsheetToolbarType event to change the toolbars and tabs for a specific editor only:

    1. In the WinForms Module project, create a View Controller. If your solution does not contain this project, add the Controller to the WinForms application project.

    2. Access the SpreadsheetMenuManagerController and subscribe to its CustomizeSpreadsheetToolbarType event in the overridden OnActivated method.

    3. In the event handler, specify the CustomizeSpreadsheetToolbarTypeEventArgs.SpreadsheetToolbarType property.

    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Office.Win;
    using DevExpress.XtraSpreadsheet;
    // ...
    public class CustomSpreadsheetController : ViewController {
        protected override void OnActivated() {
            base.OnActivated();
            SpreadsheetMenuManagerController controller = Frame.GetController<SpreadsheetMenuManagerController>();
            if (controller != null) {
                controller.CustomizeSpreadsheetToolbarType += Controller_CustomizeSpreadsheetToolbarType;
            }
        }
        private void Controller_CustomizeSpreadsheetToolbarType(object sender, CustomizeSpreadsheetToolbarTypeEventArgs e) {
            e.SpreadsheetToolbarType |= SpreadsheetToolbarType.ChartTools | SpreadsheetToolbarType.TableTools;
        }
    }
    

    You can also customize the Bars menu at runtime. Your customizations are stored in the user’s model differences.

    See Also