fpspreadsheet: Add standard actions for predefined cell border combinations
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3731 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
e9beda10fb
commit
bd2ef6579f
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,25 @@ type
|
|||||||
MenuItem29: TMenuItem;
|
MenuItem29: TMenuItem;
|
||||||
MenuItem3: TMenuItem;
|
MenuItem3: TMenuItem;
|
||||||
MenuItem30: TMenuItem;
|
MenuItem30: TMenuItem;
|
||||||
|
MenuItem31: TMenuItem;
|
||||||
|
MenuItem32: TMenuItem;
|
||||||
|
MenuItem33: TMenuItem;
|
||||||
|
MenuItem34: TMenuItem;
|
||||||
|
MenuItem35: TMenuItem;
|
||||||
|
MenuItem36: TMenuItem;
|
||||||
|
MenuItem37: TMenuItem;
|
||||||
|
MenuItem38: TMenuItem;
|
||||||
|
MenuItem39: TMenuItem;
|
||||||
MenuItem4: TMenuItem;
|
MenuItem4: TMenuItem;
|
||||||
|
MenuItem40: TMenuItem;
|
||||||
|
MenuItem41: TMenuItem;
|
||||||
|
MenuItem42: TMenuItem;
|
||||||
|
MenuItem43: TMenuItem;
|
||||||
|
MenuItem44: TMenuItem;
|
||||||
|
MenuItem45: TMenuItem;
|
||||||
|
MenuItem46: TMenuItem;
|
||||||
|
MenuItem47: TMenuItem;
|
||||||
|
MenuItem48: TMenuItem;
|
||||||
MenuItem5: TMenuItem;
|
MenuItem5: TMenuItem;
|
||||||
MenuItem6: TMenuItem;
|
MenuItem6: TMenuItem;
|
||||||
MenuItem7: TMenuItem;
|
MenuItem7: TMenuItem;
|
||||||
@ -76,6 +94,7 @@ type
|
|||||||
AcNumFormatPercentage: TsNumberFormatAction;
|
AcNumFormatPercentage: TsNumberFormatAction;
|
||||||
AcNumFormatCurrency: TsNumberFormatAction;
|
AcNumFormatCurrency: TsNumberFormatAction;
|
||||||
AcNumFormatCurrencyRed: TsNumberFormatAction;
|
AcNumFormatCurrencyRed: TsNumberFormatAction;
|
||||||
|
PuBorders: TPopupMenu;
|
||||||
PuTimeFormat: TPopupMenu;
|
PuTimeFormat: TPopupMenu;
|
||||||
PuDateFormat: TPopupMenu;
|
PuDateFormat: TPopupMenu;
|
||||||
PuCurrencyFormat: TPopupMenu;
|
PuCurrencyFormat: TPopupMenu;
|
||||||
@ -94,6 +113,22 @@ type
|
|||||||
AcDecDecimals: TsDecimalsAction;
|
AcDecDecimals: TsDecimalsAction;
|
||||||
AcCellFont: TsFontAction;
|
AcCellFont: TsFontAction;
|
||||||
AcBackgroundColor: TsBackgroundColorAction;
|
AcBackgroundColor: TsBackgroundColorAction;
|
||||||
|
AcCellBorderTop: TsCellBorderAction;
|
||||||
|
AcCellBorderBottom: TsCellBorderAction;
|
||||||
|
AcCellBorderLeft: TsCellBorderAction;
|
||||||
|
AcCellBorderRight: TsCellBorderAction;
|
||||||
|
AcCellBorderInnerHor: TsCellBorderAction;
|
||||||
|
AcCellBorderInnerVert: TsCellBorderAction;
|
||||||
|
AcCellBorderAllHor: TsCellBorderAction;
|
||||||
|
AcCellBorderBottomThick: TsCellBorderAction;
|
||||||
|
AcCellBorderBottomDbl: TsCellBorderAction;
|
||||||
|
AcCellBorderAllOuter: TsCellBorderAction;
|
||||||
|
AcCellBorderNone: TsNoCellBordersAction;
|
||||||
|
AcCellBorderAllOuterThick: TsCellBorderAction;
|
||||||
|
AcCellBorderTopBottomThick: TsCellBorderAction;
|
||||||
|
AcCellBorderTopBottomDbl: TsCellBorderAction;
|
||||||
|
AcCellBorderAll: TsCellBorderAction;
|
||||||
|
AcCellBorderAllVert: TsCellBorderAction;
|
||||||
ToolButton11: TToolButton;
|
ToolButton11: TToolButton;
|
||||||
ToolButton12: TToolButton;
|
ToolButton12: TToolButton;
|
||||||
ToolButton13: TToolButton;
|
ToolButton13: TToolButton;
|
||||||
@ -128,6 +163,7 @@ type
|
|||||||
ToolButton3: TToolButton;
|
ToolButton3: TToolButton;
|
||||||
ToolButton30: TToolButton;
|
ToolButton30: TToolButton;
|
||||||
ToolButton31: TToolButton;
|
ToolButton31: TToolButton;
|
||||||
|
TbBorders: TToolButton;
|
||||||
ToolButton4: TToolButton;
|
ToolButton4: TToolButton;
|
||||||
ToolButton5: TToolButton;
|
ToolButton5: TToolButton;
|
||||||
ToolButton6: TToolButton;
|
ToolButton6: TToolButton;
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
{ fpActions }
|
||||||
|
|
||||||
|
{@@ ----------------------------------------------------------------------------
|
||||||
|
A collection of standard actions to simplify creation of menu and toolbar
|
||||||
|
for spreadsheet applications.
|
||||||
|
|
||||||
|
AUTHORS: Werner Pamler
|
||||||
|
|
||||||
|
LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus
|
||||||
|
distribution, for details about the license.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
unit fpsActions;
|
unit fpsActions;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -31,6 +42,7 @@ type
|
|||||||
property WorkbookSource: TsWorkbookSource read FWorkbookSource write FWorkbookSource;
|
property WorkbookSource: TsWorkbookSource read FWorkbookSource write FWorkbookSource;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ --- Actions related to worksheets --- }
|
{ --- Actions related to worksheets --- }
|
||||||
|
|
||||||
TsWorksheetAction = class(TsSpreadsheetAction)
|
TsWorksheetAction = class(TsSpreadsheetAction)
|
||||||
@ -125,9 +137,7 @@ type
|
|||||||
property Visible;
|
property Visible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsFontStyleAction }
|
{ TsFontStyleAction }
|
||||||
|
|
||||||
TsFontStyleAction = class(TsAutoFormatAction)
|
TsFontStyleAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
FFontStyle: TsFontStyle;
|
FFontStyle: TsFontStyle;
|
||||||
@ -142,9 +152,7 @@ type
|
|||||||
read FFontStyle write SetFontStyle;
|
read FFontStyle write SetFontStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsHorAlignmentAction }
|
{ TsHorAlignmentAction }
|
||||||
|
|
||||||
TsHorAlignmentAction = class(TsAutoFormatAction)
|
TsHorAlignmentAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
FHorAlign: TsHorAlignment;
|
FHorAlign: TsHorAlignment;
|
||||||
@ -159,9 +167,7 @@ type
|
|||||||
read FHorAlign write SetHorAlign default haDefault;
|
read FHorAlign write SetHorAlign default haDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsVertAlignmentAction }
|
{ TsVertAlignmentAction }
|
||||||
|
|
||||||
TsVertAlignmentAction = class(TsAutoFormatAction)
|
TsVertAlignmentAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
FVertAlign: TsVertAlignment;
|
FVertAlign: TsVertAlignment;
|
||||||
@ -176,9 +182,7 @@ type
|
|||||||
read FVertAlign write SetVertAlign default vaDefault;
|
read FVertAlign write SetVertAlign default vaDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsTextRotationAction }
|
{ TsTextRotationAction }
|
||||||
|
|
||||||
TsTextRotationAction = class(TsAutoFormatAction)
|
TsTextRotationAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
FTextRotation: TsTextRotation;
|
FTextRotation: TsTextRotation;
|
||||||
@ -193,9 +197,7 @@ type
|
|||||||
read FTextRotation write SetTextRotation default trHorizontal;
|
read FTextRotation write SetTextRotation default trHorizontal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsWordwrapAction }
|
{ TsWordwrapAction }
|
||||||
|
|
||||||
TsWordwrapAction = class(TsAutoFormatAction)
|
TsWordwrapAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
function GetWordwrap: Boolean;
|
function GetWordwrap: Boolean;
|
||||||
@ -210,9 +212,7 @@ type
|
|||||||
read GetWordwrap write SetWordwrap default false;
|
read GetWordwrap write SetWordwrap default false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsNumberFormatAction }
|
{ TsNumberFormatAction }
|
||||||
|
|
||||||
TsNumberFormatAction = class(TsAutoFormatAction)
|
TsNumberFormatAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
FNumberFormat: TsNumberFormat;
|
FNumberFormat: TsNumberFormat;
|
||||||
@ -231,9 +231,7 @@ type
|
|||||||
read FNumberFormatStr write SetNumberFormatStr;
|
read FNumberFormatStr write SetNumberFormatStr;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsDecimalsAction }
|
{ TsDecimalsAction }
|
||||||
|
|
||||||
TsDecimalsAction = class(TsAutoFormatAction)
|
TsDecimalsAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
FDecimals: Integer;
|
FDecimals: Integer;
|
||||||
@ -251,8 +249,95 @@ type
|
|||||||
property Hint stored false;
|
property Hint stored false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TsCellBorderAction }
|
||||||
|
TsActionBorder = class(TPersistent)
|
||||||
|
private
|
||||||
|
FLineStyle: TsLineStyle;
|
||||||
|
FColor: TColor;
|
||||||
|
FVisible: Boolean;
|
||||||
|
public
|
||||||
|
procedure ApplyStyle(AWorkbook: TsWorkbook; out ABorderStyle: TsCellBorderStyle);
|
||||||
|
procedure ExtractStyle(AWorkbook: TsWorkbook; ABorderStyle: TsCellBorderStyle);
|
||||||
|
published
|
||||||
|
property LineStyle: TsLineStyle read FLineStyle write FLineStyle;
|
||||||
|
property Color: TColor read FColor write FColor;
|
||||||
|
property Visible: Boolean read FVisible write FVisible;
|
||||||
|
end;
|
||||||
|
|
||||||
{ --- Actions like from TCommonDialogAction --- }
|
TsActionBorders = class(TPersistent)
|
||||||
|
private
|
||||||
|
FBorders: Array[TsCellBorder] of TsActionBorder;
|
||||||
|
function GetBorder(AIndex: TsCellBorder): TsActionBorder;
|
||||||
|
procedure SetBorder(AIndex: TsCellBorder; AValue: TsActionBorder);
|
||||||
|
public
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure ExtractFromCell(AWorkbook: TsWorkbook; ACell: PCell);
|
||||||
|
published
|
||||||
|
property East: TsActionBorder index cbEast
|
||||||
|
read GetBorder write SetBorder;
|
||||||
|
property North: TsActionBorder index cbNorth
|
||||||
|
read GetBorder write SetBorder;
|
||||||
|
property South: TsActionBorder index cbSouth
|
||||||
|
read GetBorder write SetBorder;
|
||||||
|
property West: TsActionBorder index cbWest
|
||||||
|
read GetBorder write SetBorder;
|
||||||
|
property InnerHor: TsActionBorder index cbDiagUp // NOTE: "abusing" cbDiagUp here!
|
||||||
|
read GetBorder write SetBorder;
|
||||||
|
property InnerVert: TsActionBorder index cbDiagDown // NOTE: "abusing" cbDiagDown here"
|
||||||
|
read GetBorder write SetBorder;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TsCellBorderAction = class(TsCellAction)
|
||||||
|
private
|
||||||
|
FBorders: TsActionBorders;
|
||||||
|
protected
|
||||||
|
procedure ApplyFormatToRange(ARange: TsCellRange); override;
|
||||||
|
procedure ExtractFromCell(ACell: PCell); override;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure ExecuteTarget(Target: TObject); override;
|
||||||
|
published
|
||||||
|
property Borders: TsActionBorders read FBorders write FBorders;
|
||||||
|
property Caption;
|
||||||
|
property Enabled;
|
||||||
|
property HelpContext;
|
||||||
|
property HelpKeyword;
|
||||||
|
property HelpType;
|
||||||
|
property Hint;
|
||||||
|
property ImageIndex;
|
||||||
|
property OnExecute;
|
||||||
|
property OnHint;
|
||||||
|
property OnUpdate;
|
||||||
|
property SecondaryShortCuts;
|
||||||
|
property ShortCut;
|
||||||
|
property Visible;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TsNoCellBordersAction = class(TsCellAction)
|
||||||
|
protected
|
||||||
|
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||||
|
public
|
||||||
|
procedure ExecuteTarget(Target: TObject); override;
|
||||||
|
published
|
||||||
|
property Caption;
|
||||||
|
property Enabled;
|
||||||
|
property HelpContext;
|
||||||
|
property HelpKeyword;
|
||||||
|
property HelpType;
|
||||||
|
property Hint;
|
||||||
|
property ImageIndex;
|
||||||
|
property OnExecute;
|
||||||
|
property OnHint;
|
||||||
|
property OnUpdate;
|
||||||
|
property SecondaryShortCuts;
|
||||||
|
property ShortCut;
|
||||||
|
property Visible;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ --- Actions like those derived from TCommonDialogAction --- }
|
||||||
|
|
||||||
TsCommonDialogSpreadsheetAction = class(TsSpreadsheetAction)
|
TsCommonDialogSpreadsheetAction = class(TsSpreadsheetAction)
|
||||||
private
|
private
|
||||||
@ -276,9 +361,7 @@ type
|
|||||||
property OnCancel: TNotifyEvent read FOnCancel write FOnCancel;
|
property OnCancel: TNotifyEvent read FOnCancel write FOnCancel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsCommondDialogCellAction }
|
{ TsCommondDialogCellAction }
|
||||||
|
|
||||||
TsCommonDialogCellAction = class(TsCommondialogSpreadsheetAction)
|
TsCommonDialogCellAction = class(TsCommondialogSpreadsheetAction)
|
||||||
protected
|
protected
|
||||||
procedure DoAccept; override;
|
procedure DoAccept; override;
|
||||||
@ -305,9 +388,7 @@ type
|
|||||||
property OnHint;
|
property OnHint;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsFontAction }
|
{ TsFontAction }
|
||||||
|
|
||||||
TsFontAction = class(TsCommonDialogCellAction)
|
TsFontAction = class(TsCommonDialogCellAction)
|
||||||
private
|
private
|
||||||
function GetDialog: TFontDialog;
|
function GetDialog: TFontDialog;
|
||||||
@ -322,7 +403,6 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ TsBackgroundColorAction }
|
{ TsBackgroundColorAction }
|
||||||
|
|
||||||
TsBackgroundColorAction = class(TsCommonDialogCellAction)
|
TsBackgroundColorAction = class(TsCommonDialogCellAction)
|
||||||
private
|
private
|
||||||
FBackgroundColor: TsColor;
|
FBackgroundColor: TsColor;
|
||||||
@ -356,7 +436,8 @@ begin
|
|||||||
TsFontAction, TsFontStyleAction, TsBackgroundColorAction,
|
TsFontAction, TsFontStyleAction, TsBackgroundColorAction,
|
||||||
TsHorAlignmentAction, TsVertAlignmentAction,
|
TsHorAlignmentAction, TsVertAlignmentAction,
|
||||||
TsTextRotationAction, TsWordWrapAction,
|
TsTextRotationAction, TsWordWrapAction,
|
||||||
TsNumberFormatAction, TsDecimalsAction
|
TsNumberFormatAction, TsDecimalsAction,
|
||||||
|
TsCellBorderAction, TsNoCellBordersAction
|
||||||
], nil);
|
], nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -958,6 +1039,175 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsCellBorderAction }
|
||||||
|
|
||||||
|
procedure TsActionBorder.ApplyStyle(AWorkbook: TsWorkbook;
|
||||||
|
out ABorderStyle: TsCellBorderStyle);
|
||||||
|
begin
|
||||||
|
ABorderStyle.LineStyle := FLineStyle;
|
||||||
|
ABorderStyle.Color := AWorkbook.GetPaletteColor(ABorderStyle.Color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsActionBorder.ExtractStyle(AWorkbook: TsWorkbook;
|
||||||
|
ABorderStyle: TsCellBorderStyle);
|
||||||
|
begin
|
||||||
|
FLineStyle := ABorderStyle.LineStyle;
|
||||||
|
Color := AWorkbook.AddColorToPalette(ABorderStyle.Color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TsActionBorders.Create;
|
||||||
|
var
|
||||||
|
cb: TsCellBorder;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
for cb in TsCellBorder do
|
||||||
|
FBorders[cb] := TsActionBorder.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TsActionBorders.Destroy;
|
||||||
|
var
|
||||||
|
cb: TsCellBorder;
|
||||||
|
begin
|
||||||
|
for cb in TsCellBorder do FBorders[cb].Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsActionBorders.ExtractFromCell(AWorkbook: TsWorkbook; ACell: PCell);
|
||||||
|
var
|
||||||
|
cb: TsCellBorder;
|
||||||
|
begin
|
||||||
|
if (ACell = nil) or not (uffBorder in ACell^.UsedFormattingFields) then
|
||||||
|
for cb in TsCellBorder do
|
||||||
|
begin
|
||||||
|
FBorders[cb].ExtractStyle(AWorkbook, DEFAULT_BORDERSTYLES[cb]);
|
||||||
|
FBorders[cb].Visible := false;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for cb in TsCellBorder do
|
||||||
|
begin
|
||||||
|
FBorders[cb].ExtractStyle(AWorkbook, ACell^.BorderStyles[cb]);
|
||||||
|
FBorders[cb].Visible := cb in ACell^.Border;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TsActionBorders.GetBorder(AIndex: TsCellBorder): TsActionBorder;
|
||||||
|
begin
|
||||||
|
Result := FBorders[AIndex];
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsActionBorders.SetBorder(AIndex: TsCellBorder;
|
||||||
|
AValue: TsActionBorder);
|
||||||
|
begin
|
||||||
|
FBorders[AIndex] := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TsCellBorderAction.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FBorders := TsActionBorders.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TsCellBorderAction.Destroy;
|
||||||
|
begin
|
||||||
|
FBorders.Free;
|
||||||
|
inherited;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsCellBorderAction.ApplyFormatToRange(ARange: TsCellRange);
|
||||||
|
|
||||||
|
procedure ShowBorder(ABorder: TsCellBorder; ACell: PCell;
|
||||||
|
ABorderStyle: TsCellBorderStyle; AEnable: boolean);
|
||||||
|
var
|
||||||
|
brdr: TsCellBorders;
|
||||||
|
begin
|
||||||
|
brdr := ACell^.Border;
|
||||||
|
if AEnable then
|
||||||
|
begin
|
||||||
|
Include(brdr, ABorder);
|
||||||
|
Worksheet.WriteBorderStyle(ACell, ABorder, ABorderStyle);
|
||||||
|
Worksheet.WriteBorders(ACell, brdr);
|
||||||
|
// Don't modify the cell directly, this will miss the OnChange event.
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
r, c: LongInt;
|
||||||
|
ls: TsLineStyle;
|
||||||
|
bs: TsCellBorderStyle;
|
||||||
|
cell: PCell;
|
||||||
|
begin
|
||||||
|
// Top edges
|
||||||
|
Borders.North.ApplyStyle(Workbook, bs);
|
||||||
|
for c := ARange.Col1 to ARange.Col2 do
|
||||||
|
ShowBorder(cbNorth, Worksheet.GetCell(ARange.Row1, c), bs, Borders.North.Visible);
|
||||||
|
|
||||||
|
// Bottom edges
|
||||||
|
Borders.South.ApplyStyle(Workbook, bs);
|
||||||
|
for c := ARange.Col1 to ARange.Col2 do
|
||||||
|
ShowBorder(cbSouth, Worksheet.GetCell(ARange.Row2, c), bs, Borders.South.Visible);
|
||||||
|
|
||||||
|
// Inner horizontal edges
|
||||||
|
Borders.InnerHor.ApplyStyle(Workbook, bs);
|
||||||
|
for c := ARange.Col1 to ARange.Col2 do
|
||||||
|
begin
|
||||||
|
for r := ARange.Row1 to LongInt(ARange.Row2)-1 do
|
||||||
|
ShowBorder(cbSouth, Worksheet.GetCell(r, c), bs, Borders.InnerHor.Visible);
|
||||||
|
for r := ARange.Row1+1 to ARange.Row2 do
|
||||||
|
ShowBorder(cbNorth, Worksheet.GetCell(r, c), bs, Borders.InnerHor.Visible);
|
||||||
|
end;
|
||||||
|
|
||||||
|
// Left edges
|
||||||
|
Borders.West.ApplyStyle(Workbook, bs);
|
||||||
|
for r := ARange.Row1 to ARange.Row2 do
|
||||||
|
ShowBorder(cbWest, Worksheet.GetCell(r, ARange.Col1), bs, Borders.West.Visible);
|
||||||
|
|
||||||
|
// Right edges
|
||||||
|
Borders.East.ApplyStyle(Workbook, bs);
|
||||||
|
for r := ARange.Row1 to ARange.Row2 do
|
||||||
|
ShowBorder(cbEast, Worksheet.GetCell(r, ARange.Col2), bs, Borders.East.Visible);
|
||||||
|
|
||||||
|
// Inner vertical lines
|
||||||
|
Borders.InnerVert.ApplyStyle(Workbook, bs);
|
||||||
|
for r := ARange.Row1 to ARange.Row2 do
|
||||||
|
begin
|
||||||
|
for c := ARange.Col1 to LongInt(ARange.Col2)-1 do
|
||||||
|
ShowBorder(cbEast, Worksheet.GetCell(r, c), bs, Borders.InnerVert.Visible);
|
||||||
|
for c := ARange.Col1+1 to ARange.Col2 do
|
||||||
|
ShowBorder(cbWest, Worksheet.GetCell(r, c), bs, Borders.InnerVert.Visible);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsCellBorderAction.ExecuteTarget(Target: TObject);
|
||||||
|
begin
|
||||||
|
ApplyFormatToSelection;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsCellBorderAction.ExtractFromCell(ACell: PCell);
|
||||||
|
var
|
||||||
|
EmptyCell: TCell;
|
||||||
|
begin
|
||||||
|
if (ACell = nil) or not (uffBorder in ACell^.UsedFormattingFields) then
|
||||||
|
begin
|
||||||
|
InitCell(EmptyCell);
|
||||||
|
FBorders.ExtractFromCell(Workbook, @EmptyCell);
|
||||||
|
end else
|
||||||
|
FBorders.ExtractFromCell(Workbook, ACell);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TsNoCellBordersAction }
|
||||||
|
|
||||||
|
procedure TsNoCellBordersAction.ApplyFormatToCell(ACell: PCell);
|
||||||
|
begin
|
||||||
|
Worksheet.WriteBorders(ACell, []);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TsNoCellBordersAction.ExecuteTarget(Target: TObject);
|
||||||
|
begin
|
||||||
|
ApplyFormatToSelection;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TsCommonDialogSpreadsheetAction }
|
{ TsCommonDialogSpreadsheetAction }
|
||||||
|
|
||||||
constructor TsCommonDialogSpreadsheetAction.Create(AOwner: TComponent);
|
constructor TsCommonDialogSpreadsheetAction.Create(AOwner: TComponent);
|
||||||
|
Loading…
Reference in New Issue
Block a user