Workbook Events

EventWhen
WorksheetCreatedWhen a new worksheet instance has been created
WorksheetInsertedWhen a worksheet has been inserted into the workbook
WorksheetRemovedWhen a worksheet has been removed from the workbook
BeforeWorksheetNameChangeBefore the worksheet name changes; set the IsCancelled property to abort this operation
WorksheetNameChangedWhen the worksheet name has been changed
WorksheetNameBackColorChangedWhen the background color of a worksheet tab has been changed
WorksheetNameTextColorChangedWhen the text color of a worksheet tab has been changed
SettingsChangedWhen any workbook setting has been changed
ExceptionHappenedWhen an internal exception occurs in any worksheet

Action Events

EventWhen
BeforeActionPerformBefore any action is performed
ActionPerformedWhen any action has been performed
UndidWhen an action is undone
RedidWhen an action is redone

Worksheet Events

Worksheet events are available on worksheet instances. To get a worksheet instance, use the CurrentWorksheet or Worksheets[index] property of the workbook (grid control). See Worksheet.

Cell Events

EventWhen
BeforeCellEditBefore any cell enters edit mode
AfterCellEditWhen any cell has been edited by the user
CellDataChangedWhen a cell’s data has been changed
CellMouseEnterWhen the mouse moves into a cell (the cell becomes hovered)
CellMouseLeaveWhen the mouse leaves a hovered cell
CellMouseDownWhen a mouse button is pressed inside a cell
CellMouseUpWhen a mouse button is released inside a cell
CellMouseMoveWhen the mouse moves inside a cell

For cell edit events, see cell edit.

Keyboard Events

EventWhen
BeforeCellKeyDownWhen the user presses any key on the worksheet (before native behaviors)
AfterCellKeyDownWhen the user presses any key on the worksheet (after native behaviors)
CellKeyUpWhen the user releases any key on the worksheet

Row and Column Events

EventWhen
RowInsertedWhen rows are inserted
RowDeletedWhen rows are deleted
ColInsertedWhen columns are inserted
ColDeletedWhen columns are deleted
RowsHeightChangedWhen row height changes
ColumnsWidthChangedWhen column width changes
RowFilteredWhen a filter is applied to rows
RowSortedWhen rows are sorted

Range Events

EventWhen
RangeDataChangedWhen a data update operation on a range is performed
RangeMergedWhen a range is merged
RangeUnmergedWhen a range is unmerged
RangeStyleChangedWhen styles have been set
BeforeRangeCopyBefore the selected range is copied
BeforeRangeMoveBefore the selected range is moved
AfterRangeCopyAfter a range copy operation
AfterRangeMoveAfter a range move operation

Border Events

EventWhen
BorderAddedWhen borders have been set
BorderRemovedWhen borders have been removed

Selection Events

EventWhen
SelectionRangeChangedAfter the selection range changes
SelectionRangeChangingFired while the selection is changing by mouse
SelectionModeChangedWhen the selection mode changes
SelectionStyleChangedWhen the selection style changes
SelectionForwardDirectionChangedWhen the selection forward direction changes
SelectionMovedForwardWhen the selection moves to the next position
HoverPosChangedWhen the mouse moves over cells
FocusPosChangedWhen the focused cell changes

Learn more about Selection.

Outline Events

EventWhen
OutlineAddedWhen an outline has been added to the spreadsheet
OutlineRemovedWhen an outline has been removed from the spreadsheet
BeforeOutlineCollapseWhen the user clicks the − button on an outline to collapse it
AfterOutlineCollapseWhen an outline has been collapsed
BeforeOutlineExpandWhen the user clicks the + button on an outline to expand it
AfterOutlineExpandWhen an outline has been expanded

For usage of outline events, see Group & Outline.

Freeze Events

EventWhen
CellsFrozenWhen the worksheet has been frozen
CellsUnfrozenWhen the worksheet has been unfrozen

Learn more about freeze: see Freeze.

Generic Events

EventWhen
ScaledWhen the control is scaled (zoomed in/out)
FileLoadedWhen the control’s content is loaded from a file stream (loading from a given stream will not fire this event)
FileSavedWhen the control’s content has been saved to a file stream (saving to a given stream will not fire this event)
ResetWhen the control has been reset to its default state

Clipboard Events

EventWhen
BeforeCopyBefore a copy operation
AfterCopyAfter a range is copied to the clipboard
BeforePasteBefore a paste operation
AfterPasteAfter a range is pasted from the clipboard
BeforeCutBefore a cut operation
AfterCutAfter a range is cut by the user
OnPasteErrorWhen an error occurs during a paste operation

Examples

Set an editable range by handling an event

Many before-events provided by ReoGrid have an IsCancelled property, which can be set to true to instruct the control to cancel the subsequent operation. This is typically used to prevent cell editing or outline collapse/expand operations.

For example, to allow text editing only within a specified range:

// select a worksheet
var sheet = grid.CurrentWorksheet;

// create a range definition
var editableRange = new RangePosition(3,1,2,3);

// set borders to range
sheet.SetRangeBorder(editableRange, BorderPositions.Outside, RangeBorderStyle.BlackSolid);

// set text and handle events
sheet[2, 1] = "Edit only be allowed in this range:";
sheet.BeforeCellEdit += (s, e) => e.IsCancelled = !editableRange.Contains(e.Cell.GetPos());

41

Was this article helpful?