CPF/CPF.ReoGrid/Actions/InsertRowsAction.cs
2024-06-24 10:15:59 +08:00

42 lines
848 B
C#

using System;
namespace CPF.ReoGrid.Actions
{
public class InsertRowsAction : WorksheetReusableAction
{
public int Row { get; set; }
public int Count { get; set; }
public InsertRowsAction(int row, int count) : base(RangePosition.Empty)
{
this.Row = row;
this.Count = count;
}
public override void Do()
{
this.insertedRow = this.Row;
base.Worksheet.InsertRows(this.Row, this.Count);
base.Range = new RangePosition(this.Row, 0, this.Count, base.Worksheet.ColumnCount);
}
public override void Undo()
{
base.Worksheet.DeleteRows(this.insertedRow, this.Count);
}
public override string GetName()
{
return "Insert Rows";
}
public override WorksheetReusableAction Clone(RangePosition range)
{
return new InsertRowsAction(range.Row, range.Rows);
}
private int insertedRow = -1;
}
}