expressappframework-401211-document-management-office-module-customize-spreadsheet-editors.md
Note
XAF does not support the Spreadsheet editor for ASP.NET Core Blazor applications.
This section shows how to use the Model Editor to customize the Spreadsheet Property Editor in a WinForms project.
The SpreadsheetPropertyEditor displays the Spreadsheet control with a Formula Bar (WinForms).
Formula Bar in a WinForms application
In the Model Editor, navigate to the Views | <DetailView> | Items | <PropertyEditor> node and specify the EnableFormulaBar property to show or hide the Formula Bar.
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.
In the WinForms application project, create a View Controller.
In the overridden OnActivated method, access the SpreadsheetPropertyEditor as described in the Ways to Access UI Elements and Their Controls topic.
Specify the editor’s DocumentFormat property.
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:
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.
Access the SpreadsheetMenuManagerController and subscribe to its CustomizeSpreadsheetToolbarType event in the overridden OnActivated method.
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