Skip to main content
All docs
V25.1
  • Row

    Worksheet.FreezeRows(Int32, CellRange) Method

    Freezes the specified number of rows below the specified cell, including the row that contains this cell.

    Namespace: DevExpress.Spreadsheet

    Assembly: DevExpress.Spreadsheet.v25.1.Core.dll

    NuGet Package: DevExpress.Spreadsheet.Core

    Declaration

    void FreezeRows(
        int rowOffset,
        CellRange topLeft
    )

    Parameters

    Name Type Description
    rowOffset Int32

    An integer value that specifies the zero-based offset of the last row to be frozen relative to the row that contains the specified cell (the topLeft parameter).

    topLeft CellRange

    A CellRange object that specifies a cell (or top left cell of the cell range) contained in a row from where freezing rows shall start.

    Remarks

    The FreezeRows method locks rows at the top of the worksheet, starting from the row that contains the topLeft cell and ending with the row specified by rowOffset relative to the first frozen row. Frozen rows are visible while the rest of the worksheet is scrolled.

    To freeze worksheet columns, or to freeze both rows and columns, use the Worksheet.FreezeColumns or Worksheet.FreezePanes method.

    To unfreeze panes in a worksheet, use the Worksheet.UnfreezePanes method.

    The following example demonstrates how to use the FreezeRows method to freeze three rows starting with the row 7.

    using DevExpress.Spreadsheet;
    // ...
    
    Worksheet worksheet = workbook.Worksheets[0];
    worksheet.FreezeRows(2, worksheet.Cells["C7"]);
    

    The following image shows the result of executing the code above. Rows from 7 through 9 are always visible. Other rows from 10 through the last row of the worksheet can be scrolled. The worksheet is fully scrollable horizontally, by columns.

    SpreadsheetControl_Worksheet_FreezeRows1

    See Also