42 lines
1.0 KiB
C#
42 lines
1.0 KiB
C#
using System;
|
|
using CPF.ReoGrid.DataFormat;
|
|
|
|
namespace CPF.ReoGrid.Actions
|
|
{
|
|
public class SetRangeDataFormatAction : WorksheetReusableAction
|
|
{
|
|
public SetRangeDataFormatAction(RangePosition range, CellDataFormatFlag format, object dataFormatArgs) : base(range)
|
|
{
|
|
this.format = format;
|
|
this.formatArgs = dataFormatArgs;
|
|
}
|
|
|
|
public override void Do()
|
|
{
|
|
this.backupData = base.Worksheet.GetPartialGrid(base.Range, PartialGridCopyFlag.CellData, ExPartialGridCopyFlag.None, false);
|
|
base.Worksheet.SetRangeDataFormat(base.Range, this.format, this.formatArgs);
|
|
}
|
|
|
|
public override void Undo()
|
|
{
|
|
base.Worksheet.SetPartialGrid(base.Range, this.backupData);
|
|
}
|
|
|
|
public override WorksheetReusableAction Clone(RangePosition range)
|
|
{
|
|
return new SetRangeDataFormatAction(range, this.format, this.formatArgs);
|
|
}
|
|
|
|
public override string GetName()
|
|
{
|
|
return "Set Cells Format: " + this.format.ToString();
|
|
}
|
|
|
|
private CellDataFormatFlag format;
|
|
|
|
private object formatArgs;
|
|
|
|
private PartialGrid backupData = null;
|
|
}
|
|
}
|