This page lists all built-in action classes available in ReoGrid. Actions provide undo/redo support for worksheet operations.
Namespace
using unvell.ReoGrid.Actions;
Using Actions
// Perform an action
sheet.DoAction(new SetCellDataAction("B2", "Hello"));
// Undo / Redo
grid.Undo();
grid.Redo();
See Action Framework for details on creating custom actions and monitoring execution.
Actions Triggered by Built-in UI
| User Operation | Action | Description |
|---|
| Finish editing a cell | SetCellDataAction | Stores the new cell value |
| Press Delete to clear selection | RemoveRangeDataAction | Removes data in the selection |
| Paste ReoGrid rich content | SetPartialGridAction | Pastes data with styles, borders, merges |
| Paste plain text | SetRangeDataAction | Pastes tab-separated text as 2D array |
| Drag selection to new location | MoveRangeAction | Moves the selected range |
| Ctrl + drag selection | CopyRangeAction | Copies the selected range |
| Drag fill handle | AutoFillSerialAction | Auto-fills data from the selection |
| Drag row header separator | SetRowsHeightAction | Records the new row height |
| Drag column header separator | SetColumnsWidthAction | Records the new column width |
| Double-click column separator | AutoFitColumnsWidthAction | Auto-fits column width to content |
| Style brush copy | SetRangeStyleAction / SetRangeDataFormatAction | Applies style and format |
All Action Classes
Cell Data Actions
| Action | Constructor | Description |
|---|
SetCellDataAction | (string address, object data) | Set data of a single cell |
| (CellPosition pos, object data) | |
| (int row, int col, object data) | |
SetRangeDataAction | (RangePosition range, object[,] data) | Set data for a range from a 2D array |
RemoveRangeDataAction | (RangePosition range) | Remove data from a range |
SetPartialGridAction | (RangePosition range, PartialGrid data, PartialGridCopyFlag flags) | Set a partial grid (data + styles + borders) |
Range Move/Copy Actions
| Action | Constructor | Description |
|---|
MoveRangeAction | (RangePosition fromRange, CellPosition toPosition) | Move a range to a new position |
CopyRangeAction | (RangePosition fromRange, CellPosition toPosition) | Copy a range to a new position |
AutoFillSerialAction | (RangePosition sourceRange, RangePosition targetRange) | Auto-fill from source to target range |
Row and Column Actions
| Action | Constructor | Description |
|---|
InsertRowsAction | (int row, int count) | Insert rows before the specified row |
RemoveRowsAction | (int row, int count) | Remove rows starting at the specified row |
InsertColumnsAction | (int column, int count) | Insert columns before the specified column |
RemoveColumnsAction | (int column, int count) | Remove columns starting at the specified column |
SetRowsHeightAction | (int row, int count, ushort height) | Set height for a range of rows |
SetColumnsWidthAction | (int col, int count, ushort width) | Set width for a range of columns |
AutoFitColumnsWidthAction | (int col, int count, int padding = 0) | Auto-fit column width to content |
Visibility Actions
| Action | Constructor | Description |
|---|
HideRowsAction | (int row, int count) | Hide rows |
UnhideRowsAction | (int row, int count) | Show hidden rows |
HideColumnsAction | (int col, int count) | Hide columns |
UnhideColumnsAction | (int col, int count) | Show hidden columns |
Merge Actions
| Action | Constructor | Description |
|---|
MergeRangeAction | (RangePosition range) | Merge a range into a single cell |
UnmergeRangeAction | (RangePosition range) | Unmerge a merged range |
| Action | Constructor | Description |
|---|
SetRangeStyleAction | (RangePosition range, WorksheetRangeStyle style) | Apply styles to a range |
| (string address, WorksheetRangeStyle style) | |
| (int row, int col, int rows, int cols, WorksheetRangeStyle style) | |
RemoveRangeStyleAction | (RangePosition range, PlainStyleFlag flag) | Remove specific styles from a range |
SetRangeBorderAction | (RangePosition range, BorderPositions pos, RangeBorderStyle style) | Set borders on a range |
RemoveRangeBorderAction | (RangePosition range, BorderPositions pos) | Remove borders from a range |
SetRangeDataFormatAction | (RangePosition range, CellDataFormatFlag format, object args) | Set data format for a range |
StepRangeFontSizeAction | (RangePosition range, bool enlarge) | Increase or decrease font size |
Outline Actions
| Action | Constructor | Description |
|---|
AddOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | Add a row/column outline |
RemoveOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | Remove a row/column outline |
ClearOutlineAction | (RowOrColumn rowOrColumn) | Clear all outlines |
CollapseOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | Collapse an outline |
ExpandOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | Expand an outline |
Filter Actions
| Action | Constructor | Description |
|---|
CreateAutoFilterAction | (RangePosition range) | Create a column auto-filter |
Workbook Actions
| Action | Constructor | Description |
|---|
InsertWorksheetAction | (int index, Worksheet worksheet) | Insert a worksheet at the specified index |
RemoveWorksheetAction | (int index, Worksheet worksheet) | Remove a worksheet at the specified index |
Action Groups
| Action | Constructor | Description |
|---|
WorksheetActionGroup | () | Group multiple actions as one undo item |
WorksheetReusableActionGroup | (RangePosition range) | Repeatable action group for a range |
Examples
Set Cell Data
sheet.DoAction(new SetCellDataAction("B2", "Hello"));
Paste a 2D Array
var data = new object[,] { { 1, 2 }, { 3, 4 } };
sheet.DoAction(new SetRangeDataAction(new RangePosition("C3:D4"), data));
Insert Rows
sheet.DoAction(new InsertRowsAction(5, 2)); // Insert 2 rows before row 5
Apply Styles
sheet.DoAction(new SetRangeStyleAction("A1:C3", new WorksheetRangeStyle
{
Flag = PlainStyleFlag.BackColor | PlainStyleFlag.Bold,
BackColor = Color.LightYellow,
Bold = true,
}));
Apply Borders
sheet.DoAction(new SetRangeBorderAction(
sheet.SelectionRange,
BorderPositions.Outside,
new RangeBorderStyle { Color = Colors.Black, Style = BorderLineStyle.Solid }));
Group Actions
var group = new WorksheetActionGroup();
group.Actions.Add(new SetCellDataAction(0, 0, "Key"));
group.Actions.Add(new SetCellDataAction(0, 1, "Value"));
group.Actions.Add(new SetCellDataAction(0, 2, "Description"));
grid.DoAction(sheet, group); // One undo item
Move Range
sheet.DoAction(new MoveRangeAction(
sheet.SelectionRange,
new CellPosition(10, 2)));