このページでは、ReoGridで利用可能なすべての組み込みアクションクラスを一覧にしています。アクションはワークシート操作の元に戻す/やり直しサポートを提供します。
using unvell.ReoGrid.Actions;
// Perform an action
sheet.DoAction(new SetCellDataAction("B2", "Hello"));
// Undo / Redo
grid.Undo();
grid.Redo();
カスタムアクションの作成と実行の監視の詳細については、アクションフレームワークを参照してください。
| ユーザー操作 | アクション | 説明 |
|---|
| セルの編集完了 | SetCellDataAction | 新しいセルの値を保存 |
| Deleteキーで選択をクリア | RemoveRangeDataAction | 選択範囲のデータを削除 |
| ReoGridリッチコンテンツの貼り付け | SetPartialGridAction | スタイル、罫線、結合を含むデータを貼り付け |
| プレーンテキストの貼り付け | SetRangeDataAction | タブ区切りテキストを2D配列として貼り付け |
| 選択範囲を新しい位置にドラッグ | MoveRangeAction | 選択範囲を移動 |
| Ctrl + 選択範囲をドラッグ | CopyRangeAction | 選択範囲をコピー |
| フィルハンドルをドラッグ | AutoFillSerialAction | 選択範囲からデータを自動入力 |
| 行ヘッダーの区切りをドラッグ | SetRowsHeightAction | 新しい行の高さを記録 |
| 列ヘッダーの区切りをドラッグ | SetColumnsWidthAction | 新しい列の幅を記録 |
| 列の区切りをダブルクリック | AutoFitColumnsWidthAction | 列の幅を内容に合わせて自動調整 |
| スタイルブラシのコピー | SetRangeStyleAction / SetRangeDataFormatAction | スタイルと書式を適用 |
| アクション | コンストラクタ | 説明 |
|---|
SetCellDataAction | (string address, object data) | 単一セルのデータを設定 |
| (CellPosition pos, object data) | |
| (int row, int col, object data) | |
SetRangeDataAction | (RangePosition range, object[,] data) | 2D配列から範囲のデータを設定 |
RemoveRangeDataAction | (RangePosition range) | 範囲からデータを削除 |
SetPartialGridAction | (RangePosition range, PartialGrid data, PartialGridCopyFlag flags) | パーシャルグリッドを設定(データ + スタイル + 罫線) |
| アクション | コンストラクタ | 説明 |
|---|
MoveRangeAction | (RangePosition fromRange, CellPosition toPosition) | 範囲を新しい位置に移動 |
CopyRangeAction | (RangePosition fromRange, CellPosition toPosition) | 範囲を新しい位置にコピー |
AutoFillSerialAction | (RangePosition sourceRange, RangePosition targetRange) | ソース範囲からターゲット範囲に自動入力 |
| アクション | コンストラクタ | 説明 |
|---|
InsertRowsAction | (int row, int count) | 指定した行の前に行を挿入 |
RemoveRowsAction | (int row, int count) | 指定した行から行を削除 |
InsertColumnsAction | (int column, int count) | 指定した列の前に列を挿入 |
RemoveColumnsAction | (int column, int count) | 指定した列から列を削除 |
SetRowsHeightAction | (int row, int count, ushort height) | 行の範囲の高さを設定 |
SetColumnsWidthAction | (int col, int count, ushort width) | 列の範囲の幅を設定 |
AutoFitColumnsWidthAction | (int col, int count, int padding = 0) | 列の幅を内容に合わせて自動調整 |
| アクション | コンストラクタ | 説明 |
|---|
HideRowsAction | (int row, int count) | 行を非表示 |
UnhideRowsAction | (int row, int count) | 非表示の行を表示 |
HideColumnsAction | (int col, int count) | 列を非表示 |
UnhideColumnsAction | (int col, int count) | 非表示の列を表示 |
| アクション | コンストラクタ | 説明 |
|---|
MergeRangeAction | (RangePosition range) | 範囲を1つのセルに結合 |
UnmergeRangeAction | (RangePosition range) | 結合された範囲を解除 |
| アクション | コンストラクタ | 説明 |
|---|
SetRangeStyleAction | (RangePosition range, WorksheetRangeStyle style) | 範囲にスタイルを適用 |
| (string address, WorksheetRangeStyle style) | |
| (int row, int col, int rows, int cols, WorksheetRangeStyle style) | |
RemoveRangeStyleAction | (RangePosition range, PlainStyleFlag flag) | 範囲から特定のスタイルを削除 |
SetRangeBorderAction | (RangePosition range, BorderPositions pos, RangeBorderStyle style) | 範囲に罫線を設定 |
RemoveRangeBorderAction | (RangePosition range, BorderPositions pos) | 範囲から罫線を削除 |
SetRangeDataFormatAction | (RangePosition range, CellDataFormatFlag format, object args) | 範囲のデータ書式を設定 |
StepRangeFontSizeAction | (RangePosition range, bool enlarge) | フォントサイズを拡大または縮小 |
| アクション | コンストラクタ | 説明 |
|---|
AddOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | 行/列のアウトラインを追加 |
RemoveOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | 行/列のアウトラインを削除 |
ClearOutlineAction | (RowOrColumn rowOrColumn) | すべてのアウトラインをクリア |
CollapseOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | アウトラインを折りたたむ |
ExpandOutlineAction | (RowOrColumn rowOrColumn, int start, int count) | アウトラインを展開 |
| アクション | コンストラクタ | 説明 |
|---|
CreateAutoFilterAction | (RangePosition range) | 列の自動フィルターを作成 |
| アクション | コンストラクタ | 説明 |
|---|
InsertWorksheetAction | (int index, Worksheet worksheet) | 指定したインデックスにワークシートを挿入 |
RemoveWorksheetAction | (int index, Worksheet worksheet) | 指定したインデックスのワークシートを削除 |
| アクション | コンストラクタ | 説明 |
|---|
WorksheetActionGroup | () | 複数のアクションを1つの元に戻すアイテムとしてグループ化 |
WorksheetReusableActionGroup | (RangePosition range) | 範囲に対する繰り返し可能なアクショングループ |
sheet.DoAction(new SetCellDataAction("B2", "Hello"));
var data = new object[,] { { 1, 2 }, { 3, 4 } };
sheet.DoAction(new SetRangeDataAction(new RangePosition("C3:D4"), data));
sheet.DoAction(new InsertRowsAction(5, 2)); // Insert 2 rows before row 5
sheet.DoAction(new SetRangeStyleAction("A1:C3", new WorksheetRangeStyle
{
Flag = PlainStyleFlag.BackColor | PlainStyleFlag.Bold,
BackColor = Color.LightYellow,
Bold = true,
}));
sheet.DoAction(new SetRangeBorderAction(
sheet.SelectionRange,
BorderPositions.Outside,
new RangeBorderStyle { Color = Colors.Black, Style = BorderLineStyle.Solid }));
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
sheet.DoAction(new MoveRangeAction(
sheet.SelectionRange,
new CellPosition(10, 2)));