Clear only cell data

How to clear only the cell data of an already populated grid?


There are various grid.Clear* methods that can be used for this.

Thank you for the response. I want to clear the data of the grid, but NOT the fixed rows and columns or the formating of the cells, only the data of the .Cells property. Is there any  .Clear method that can do this?

 

I think i found it. ClearNormalCells.


FWIW, I was looking for something similar last night and found this forum message.  This is what I just put together:


  TiaAdvStringGridHelper = class helper for TAdvStringGrid
  public
    procedure ClearGridExceptFixedHeader;
  end;

procedure TiaAdvStringGridHelper.ClearGridExceptFixedHeader;
var
  vFixedRowCount:Integer;
  vHeaders:string;
begin
  vFixedRowCount := FixedRows;
  vHeaders := ColumnHeaders.Text;

  ClearAll;

  FixedRows := vFixedRowCount;
  ColumnHeaders.Text := vHeaders;
end;


Hi to all,

i have always use ClearRows(RowIndex,RCount: Integer) in order to clear a cells range or, if i have to "reset" the grid into a start condition (row and col =1 ) i use

RemoveRows(RowIndex, RCount : Integer) starting from1 to lastrow.



Regards

Daniele