Worksheet.FreezeColumns(Int32, CellRange) Method
Freezes the specified number of columns to the right of the specified cell, including the column that contains this cell.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
Declaration
Parameters
Name | Type | Description |
---|---|---|
columnOffset | Int32 | An integer value that specifies the zero-based offset of the last column to be frozen relative to the column 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 column from where freezing columns shall start. |
Remarks
The FreezeColumns method locks columns on the left side of the worksheet, starting from the column that contains the topLeft cell and ending with the column specified by columnOffset relative to the first frozen column. Frozen columns are visible while the remaining area of the worksheet is scrolled.
To freeze worksheet rows, or to freeze both rows and columns, use the Worksheet.FreezeRows or Worksheet.FreezePanes method.
To unfreeze panes in a worksheet, use the Worksheet.UnfreezePanes method.
The following example demonstrates how to use the FreezeColumns method to freeze three columns starting with column C.
using DevExpress.Spreadsheet;
// ...
Worksheet worksheet = workbook.Worksheets[0];
worksheet.FreezeColumns(2, worksheet.Cells["C7"]);
The following image shows the result of executing the code above. Columns from C through E are always visible. Other columns from F through the last column of the worksheet can be scrolled. The worksheet is fully scrollable vertically, by rows.