You've already forked lazarus-ccr
fpspreadsheet: Add TsClearFormatAction to clear a cell format.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6492 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -9255,6 +9255,11 @@ end;
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorkbook.GetPointerToCellFormat(AIndex: Integer): PsCellFormat;
|
||||
begin
|
||||
if FCellFormatList.Count = 0 then
|
||||
raise Exception.Create('[TsWorkbook.GetPointerToCellFormat]: No format items.');
|
||||
|
||||
if (AIndex < 0) or (AIndex >= FCellFormatList.Count) then
|
||||
AIndex := 0; // 0 is default format
|
||||
Result := FCellFormatList.Items[AIndex];
|
||||
end;
|
||||
|
||||
|
@ -42,6 +42,7 @@ begin
|
||||
TsWorksheetZoomAction,
|
||||
// Cell or cell range formatting actions
|
||||
TsCopyAction,
|
||||
TsClearFormatAction,
|
||||
TsFontStyleAction, TsFontDialogAction, TsBackgroundColorDialogAction,
|
||||
TsHorAlignmentAction, TsVertAlignmentAction,
|
||||
TsTextRotationAction, TsWordWrapAction,
|
||||
|
@ -180,6 +180,12 @@ type
|
||||
property Visible;
|
||||
end;
|
||||
|
||||
{ TsClearFormatAction }
|
||||
TsClearFormatAction = class(TsAutoFormatAction)
|
||||
protected
|
||||
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||
end;
|
||||
|
||||
{ TsFontStyleAction }
|
||||
TsFontStyleAction = class(TsAutoFormatAction)
|
||||
private
|
||||
@ -928,6 +934,18 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{ TsClearFormatAction }
|
||||
|
||||
procedure TsClearFormatAction.ApplyFormatToCell(ACell: PCell);
|
||||
begin
|
||||
if ACell <> nil then
|
||||
begin
|
||||
ACell^.FormatIndex := 0; // Default format
|
||||
Worksheet.ChangedCell(ACell^.Row, ACell^.Col);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TsFontStyleAction }
|
||||
|
||||
constructor TsFontStyleAction.Create(AOwner: TComponent);
|
||||
|
Reference in New Issue
Block a user