Skip to main content
A newer version of this page is available. .
Row

Worksheet.FreezeColumns(Int32) Method

Freezes the specified number of columns on the left side of the worksheet.

Namespace: DevExpress.Spreadsheet

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

Declaration

void FreezeColumns(
    int columnOffset
)

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 first column in a worksheet.

Remarks

The FreezeColumns method locks columns on the left side of the worksheet, starting from the first column in the worksheet and ending with the column specified by columnOffset relative to the first 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 first two columns in the worksheet.


using DevExpress.Spreadsheet;
// ...

IWorkbook workbook = spreadsheetControl1.Document;
Worksheet worksheet = workbook.Worksheets[0];

worksheet.FreezeColumns(1);

The following image shows the result of executing the code above. Columns A and B are always visible. Other columns from C through the last column of the worksheet can be scrolled. The worksheet is fully scrollable vertically, by rows.

SpreadsheetControl_Worksheet_FreezeColumns1

See Also