Skip to main content
A newer version of this page is available.
All docs
V18.2
Row

Worksheet.FreezeRows(Int32, Range) Method

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

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v18.2.Core.dll

Declaration

void FreezeRows(
    int rowOffset,
    Range 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 Range

A Range 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 from the row 7.


using DevExpress.Spreadsheet;
// ...

IWorkbook workbook = spreadsheetControl1.Document;
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

The following code snippets (auto-collected from DevExpress Examples) contain references to the FreezeRows(Int32, Range) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also