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:
parent
e5cb6ff0f7
commit
f62d2b35d7
@ -9255,6 +9255,11 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
function TsWorkbook.GetPointerToCellFormat(AIndex: Integer): PsCellFormat;
|
function TsWorkbook.GetPointerToCellFormat(AIndex: Integer): PsCellFormat;
|
||||||
begin
|
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];
|
Result := FCellFormatList.Items[AIndex];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,7 @@ begin
|
|||||||
TsWorksheetZoomAction,
|
TsWorksheetZoomAction,
|
||||||
// Cell or cell range formatting actions
|
// Cell or cell range formatting actions
|
||||||
TsCopyAction,
|
TsCopyAction,
|
||||||
|
TsClearFormatAction,
|
||||||
TsFontStyleAction, TsFontDialogAction, TsBackgroundColorDialogAction,
|
TsFontStyleAction, TsFontDialogAction, TsBackgroundColorDialogAction,
|
||||||
TsHorAlignmentAction, TsVertAlignmentAction,
|
TsHorAlignmentAction, TsVertAlignmentAction,
|
||||||
TsTextRotationAction, TsWordWrapAction,
|
TsTextRotationAction, TsWordWrapAction,
|
||||||
|
|||||||
@ -180,6 +180,12 @@ type
|
|||||||
property Visible;
|
property Visible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TsClearFormatAction }
|
||||||
|
TsClearFormatAction = class(TsAutoFormatAction)
|
||||||
|
protected
|
||||||
|
procedure ApplyFormatToCell(ACell: PCell); override;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TsFontStyleAction }
|
{ TsFontStyleAction }
|
||||||
TsFontStyleAction = class(TsAutoFormatAction)
|
TsFontStyleAction = class(TsAutoFormatAction)
|
||||||
private
|
private
|
||||||
@ -928,6 +934,18 @@ begin
|
|||||||
end;
|
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 }
|
{ TsFontStyleAction }
|
||||||
|
|
||||||
constructor TsFontStyleAction.Create(AOwner: TComponent);
|
constructor TsFontStyleAction.Create(AOwner: TComponent);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user