Skip to main content
Row

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Worksheet.FreezeColumns(Int32) Method

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

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

#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;
// ...

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