42 lines
884 B
C#
42 lines
884 B
C#
using System;
|
|
|
|
namespace CPF.ReoGrid.Actions
|
|
{
|
|
public class InsertColumnsAction : WorksheetReusableAction
|
|
{
|
|
public int Column { get; set; }
|
|
|
|
public int Count { get; set; }
|
|
|
|
public InsertColumnsAction(int column, int count) : base(RangePosition.Empty)
|
|
{
|
|
this.Column = column;
|
|
this.Count = count;
|
|
}
|
|
|
|
public override void Do()
|
|
{
|
|
this.insertedCol = this.Column;
|
|
base.Worksheet.InsertColumns(this.Column, this.Count);
|
|
base.Range = new RangePosition(0, this.Column, base.Worksheet.RowCount, this.Count);
|
|
}
|
|
|
|
public override void Undo()
|
|
{
|
|
base.Worksheet.DeleteColumns(this.insertedCol, this.Count);
|
|
}
|
|
|
|
public override string GetName()
|
|
{
|
|
return "Insert Columns";
|
|
}
|
|
|
|
public override WorksheetReusableAction Clone(RangePosition range)
|
|
{
|
|
return new InsertColumnsAction(range.Col, range.Cols);
|
|
}
|
|
|
|
private int insertedCol = -1;
|
|
}
|
|
}
|