[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Grids' (#lcl)

# TCustomStringGrid.Clean

Removes cell content which match the specified options.

## Declaration

Source position: grids.pas line 1805

`public procedure TCustomStringGrid.Clean; overload; procedure TCustomStringGrid.Clean(`
`CleanOptions: TGridZoneSet`
`); overload; procedure TCustomStringGrid.Clean(`
`aRect: TRect;`
`CleanOptions: TGridZoneSet`
`); overload; procedure TCustomStringGrid.Clean(`
`StartCol: Integer;`
`StartRow: Integer;`
`EndCol: Integer;`
`EndRow: Integer;`
`CleanOptions: TGridZoneSet`
`); overload;`

## Arguments

`CleanOptions` |  | Set with the grid zones affected in the method.

## Arguments

`aRect` |  | Rectangle with the bounds for the affected cells.
`CleanOptions` |  | Set with the grid zones affected in the method.

## Arguments

`StartCol` |  | Starting column number for the operation.
`StartRow` |  | Starting row number for the operation.
`EndCol` |  | Ending column number for the operation.
`EndRow` |  | Ending row number for the operation.
`CleanOptions` |  | Set with the grid zones affected in the method.

## Description

Cleans all cells in the grid subject to the given CleanOptions, optionally specifying a range of cells or a rectangular region. See TGridZoneSet for more information.

The cleaning operation does not change the number of rows and columns on the grid control. It replaces the content for the affected cells with empty strings ('').

Some examples:

Clean all cells:

    // the same as grid.clean
      grid.Clean([]);

Clean all non-fixed cells:

text

    grid.Clean([gzNormal]);

Clean all cells except fixed grid columns:

    // leaves cell content in fixed columns
      grid.Clean([gzNormal, gzFixedRows]);

Clean non-fixed cells in a rectangular region:

    // 4x3 cell area after fixed columns and rows
      grid.Clean(grid.FixedCols, grid.FixedRows, grid.FixedCols+3,
        grid.FixedRols+2, [gzNormal])

Use Clear to remove all columns and rows on the grid.

Use ColCount, FixedCols, RowCount, and FixedRows to adjust the number of columns or rows for the specific types.