60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using System;
|
|
|
|
namespace CPF.ReoGrid.Actions
|
|
{
|
|
public class SetRangeBorderAction : WorksheetReusableAction
|
|
{
|
|
public RangeBorderInfo[] Borders
|
|
{
|
|
get
|
|
{
|
|
return this.borders;
|
|
}
|
|
set
|
|
{
|
|
this.borders = value;
|
|
}
|
|
}
|
|
|
|
public SetRangeBorderAction(RangePosition range, BorderPositions pos, RangeBorderStyle styles) : this(range, new RangeBorderInfo[]
|
|
{
|
|
new RangeBorderInfo(pos, styles)
|
|
})
|
|
{
|
|
}
|
|
|
|
public SetRangeBorderAction(RangePosition range, RangeBorderInfo[] styles) : base(range)
|
|
{
|
|
this.borders = styles;
|
|
}
|
|
|
|
public override void Do()
|
|
{
|
|
this.backupData = base.Worksheet.GetPartialGrid(base.Range, PartialGridCopyFlag.BorderAll, ExPartialGridCopyFlag.BorderOutsideOwner, false);
|
|
for (int i = 0; i < this.borders.Length; i++)
|
|
{
|
|
base.Worksheet.SetRangeBorders(base.Range, this.borders[i].Pos, this.borders[i].Style);
|
|
}
|
|
}
|
|
|
|
public override void Undo()
|
|
{
|
|
base.Worksheet.SetPartialGrid(base.Range, this.backupData, PartialGridCopyFlag.BorderAll, ExPartialGridCopyFlag.BorderOutsideOwner);
|
|
}
|
|
|
|
public override string GetName()
|
|
{
|
|
return "Set Range Border";
|
|
}
|
|
|
|
public override WorksheetReusableAction Clone(RangePosition range)
|
|
{
|
|
return new SetRangeBorderAction(range, this.borders);
|
|
}
|
|
|
|
private RangeBorderInfo[] borders;
|
|
|
|
private PartialGrid backupData;
|
|
}
|
|
}
|