You've already forked lazarus-ccr
fpspreadsheet: Implement TsWorksheet.Clear (removes all content from sheet). Called by new TsWorksheetGrid.Clear.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4674 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -400,6 +400,7 @@ type
|
||||
procedure CopyValue(AFromCell, AToCell: PCell); overload;
|
||||
procedure CopyValue(AValueCell: PCell; AToRow, AToCol: Cardinal); overload;
|
||||
|
||||
procedure Clear;
|
||||
procedure DeleteCell(ACell: PCell);
|
||||
procedure EraseCell(ACell: PCell);
|
||||
|
||||
@ -1855,6 +1856,20 @@ begin
|
||||
CopyValue(AValueCell, GetCell(AToRow, AToCol));
|
||||
end;
|
||||
|
||||
procedure TsWorksheet.Clear;
|
||||
begin
|
||||
FCells.Clear;
|
||||
FComments.Clear;
|
||||
FHyperlinks.Clear;
|
||||
FMergedCells.Clear;
|
||||
|
||||
RemoveAllImages;
|
||||
RemoveAllRows;
|
||||
RemoveAllCols;
|
||||
|
||||
ChangedCell(0, 0);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Deletes a specified cell. If the cell belongs to a merged block its content
|
||||
and formatting is erased. Otherwise the cell is destroyed and its memory is
|
||||
|
@ -274,6 +274,7 @@ type
|
||||
|
||||
procedure BeginUpdate;
|
||||
function CellRect(ACol1, ARow1, ACol2, ARow2: Integer): TRect; overload;
|
||||
procedure Clear;
|
||||
procedure DefaultDrawCell(ACol, ARow: Integer; var ARect: TRect; AState: TGridDrawState); override;
|
||||
procedure DeleteCol(AGridCol: Integer); reintroduce;
|
||||
procedure DeleteRow(AGridRow: Integer); reintroduce;
|
||||
@ -1373,6 +1374,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Clears the grid contents
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsCustomWorksheetGrid.Clear;
|
||||
begin
|
||||
if (Worksheet <> nil) then Worksheet.Clear;
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Converts a spreadsheet font to a font used for painting (TCanvas.Font).
|
||||
|
||||
@ -4322,11 +4331,11 @@ begin
|
||||
|
||||
if FLockSetup > 0 then
|
||||
exit;
|
||||
|
||||
{
|
||||
if not HandleAllocated then
|
||||
//Avoid crash when accessing the canvas, e.g. in GetDefaultHeaderColWidth
|
||||
exit;
|
||||
|
||||
}
|
||||
if (Worksheet = nil) or (Worksheet.GetCellCount = 0) then begin
|
||||
FixedCols := FFrozenCols + FHeaderCount;
|
||||
FixedRows := FFrozenRows + FHeaderCount;
|
||||
|
Reference in New Issue
Block a user