[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Shapes, Pictures, Charts
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Events

This topic provides a comprehensive list of events raised in the SpreadsheetControl. All events are grouped into five categories, according to the functions they perform:

Expanded Track User Activity

The table below lists the sequence of events that are raised when an end-user performs a particular operation in the SpreadsheetControl. While it is not a comprehensive list of all end-user actions, it details events for the most common operations performed by an end-user.

User Action

Event

Create a blank workbook.

SpreadsheetControl.DocumentClosing

SpreadsheetControl.InitializeDocument

SpreadsheetControl.EmptyDocumentCreated

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Load a workbook.

SpreadsheetControl.DocumentClosing

SpreadsheetControl.BeforeImport

SpreadsheetControl.InitializeDocument

SpreadsheetControl.DocumentLoaded

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Save a workbook.

SpreadsheetControl.BeforeExport

SpreadsheetControl.ModifiedChanged

SpreadsheetControl.PropertyChanged

SpreadsheetControl.DocumentSaved

Print a workbook.

SpreadsheetControl.BeforePrintSheet

Insert a new worksheet.

SpreadsheetControl.SheetInserted

SpreadsheetControl.ActiveSheetChanging

SpreadsheetControl.ActiveSheetChanged

SpreadsheetControl.UpdateUI

Click a worksheet tab in the Sheet Tab Selector.

SpreadsheetControl.ActiveSheetChanging

SpreadsheetControl.ActiveSheetChanged

SpreadsheetControl.UpdateUI

Rename a worksheet.

SpreadsheetControl.SheetRenaming

SpreadsheetControl.SheetRenamed

SpreadsheetControl.UpdateUI

Delete a worksheet.

SpreadsheetControl.ActiveSheetChanged

SpreadsheetControl.SheetRemoved

SpreadsheetControl.UpdateUI

Insert columns in a worksheet.

SpreadsheetControl.ColumnsInserted

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Remove columns from a worksheet.

SpreadsheetControl.ColumnsRemoved

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Insert rows in a worksheet.

SpreadsheetControl.RowsInserted

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Remove rows from a worksheet.

SpreadsheetControl.RowsRemoved

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Freeze rows and columns.

SpreadsheetControl.PanesFrozen

SpreadsheetControl.UpdateUI

Unfreeze rows and columns.

SpreadsheetControl.PanesUnfrozen

SpreadsheetControl.UpdateUI

Select cells, ranges, rows, columns or shapes on a worksheet.

SpreadsheetControl.SelectionChanged

SpreadsheetControl.UpdateUI

Activate the cell's in-place editor or Formula Bar, and begin editing cell content.

SpreadsheetControl.CellBeginEdit

SpreadsheetControl.UpdateUI

Finalize the modification of cell content and close the in-place editor.

SpreadsheetControl.CellEndEdit

SpreadsheetControl.CellValueChanged

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Finalize the modification of cell content by clicking the Enter button on the Formula Bar.

SpreadsheetControl.CellEndEdit

SpreadsheetControl.CellValueChanged

SpreadsheetControl.ContentChanged

SpreadsheetFormulaBar.OkButtonClick

SpreadsheetControl.UpdateUI

Cancel the input by pressing the ESC key.

SpreadsheetFormulaBar.Rollback

SpreadsheetControl.CellCancelEdit

SpreadsheetControl.UpdateUI

Cancel the input by clicking the Cancel button on the Formula Bar.

SpreadsheetFormulaBar.Rollback

SpreadsheetControl.CellCancelEdit

SpreadsheetFormulaBar.CancelButtonClick

SpreadsheetControl.UpdateUI

Apply formatting options to cells.

SpreadsheetControl.ContentChanged

SpreadsheetControl.UpdateUI

Click a hyperlink.

SpreadsheetControl.HyperlinkClick

Zoom in or out of a worksheet.

SpreadsheetControl.ZoomChanged

SpreadsheetControl.UpdateUI

Right-click a visual element of the SpreadsheetControl.

SpreadsheetControl.PopupMenuShowing

Expanded Custom Draw

The SpreadsheetControl provides numerous custom draw events that allow you to customize document appearance. To custom paint worksheet cells, use the SpreadsheetControl.CustomDrawCell and SpreadsheetControl.CustomDrawCellBackground events. To custom draw row and column headings, handle the SpreadsheetControl.CustomDrawRowHeader, SpreadsheetControl.CustomDrawRowHeaderBackground, SpreadsheetControl.CustomDrawColumnHeader and SpreadsheetControl.CustomDrawColumnHeaderBackground events. To custom paint frozen pane borders in the SpreadsheetControl, handle the SpreadsheetControl.CustomDrawFrozenPaneBorder event.

Note that custom painting is not saved in a workbook file.

Expanded Handle Exceptions

You can catch exceptions that are not processed by the SpreadsheetControl by handling the SpreadsheetControl.InvalidFormatException and SpreadsheetControl.UnhandledException events. Use the SpreadsheetControl.InvalidFormatException event to handle exceptions raised when an end-user tries to load a document in an unsupported format. The SpreadsheetControl.UnhandledException event allows you to catch exceptions that may occur when an end-user executes a command via the SpreadsheetControl UI. For example, use this event to prevent the application from crashing when an end-user attempts to save a document to a read-only or locked file.

Expanded Track Changes to the Document Content

There are two events indicating that the current document has been modified: SpreadsheetControl.ContentChanged and SpreadsheetControl.ModifiedChanged. The SpreadsheetControl.ContentChanged event occurs each time the document content has been changed. When you use API methods to assign a value or apply formatting options to a worksheet cell, it leads to significant changes in the internal document model, and the event fires twice. The SpreadsheetControl.ModifiedChanged event indicates that the current document was modified for the first time since it was loaded or last saved, and the SpreadsheetControl.Modified property has been changed. This property can be used by validation or data-saving methods to determine if a workbook has been modified, so that its content is either validated or saved. Saving the current document also raises the SpreadsheetControl.ModifiedChanged event, since the SpreadsheetControl.Modified property reverts to false. Changing the SpreadsheetControl.Modified property value fires the SpreadsheetControl.PropertyChanged event, which occurs each time a property of the SpreadsheetControl class is modified.

Expanded Track Modifications Performed via API

Some events can be raised in response to modifications performed in code. The SpreadsheetControl.UnitChanging and SpreadsheetControl.UnitChanged events fire when the document units of measurement have been changed via the SpreadsheetControl.Unit or ISpreadsheetComponent.Unit property. When you use the SpreadsheetControl.ReadOnly property to prohibit or allow document modifications in the SpreadsheetControl, the SpreadsheetControl.ReadOnlyChanged event occurs. Use the SpreadsheetControl.BeforeDispose event to take the necessary steps for saving changes before the SpreadsheetControl instance is removed from memory.

Some events are normally raised only for changes made with the SpreadsheetControl UI (SpreadsheetControl.ActiveSheetChanged, SpreadsheetControl.ColumnsInserted, SpreadsheetControl.ColumnsRemoved, SpreadsheetControl.SelectionChanged, etc.), but you can fire them when modifications are made to a document via an API. To do this, set the WorkbookEventOptions.RaiseOnModificationsViaAPI property to true.

Is this topic helpful?​​​​​​​