Skip to main content
All docs
V24.2

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

How to: Freeze and Unfreeze Rows and Columns

  • 2 minutes to read

This topic describes how to keep specific rows and columns visible while you scroll through the worksheet.

Spreadsheet control - Frozen Panes

#Freeze Rows

Call one of the Worksheet.FreezeRows method overloads to freeze a specific number of rows at the top of the worksheet.

The following code snippet freezes the first row:

using DevExpress.Spreadsheet;
// ...

using (var workbook = new Workbook()) {
    // Access the first worksheet in the workbook.
    var worksheet = workbook.Worksheets[0];

    // Freeze the top row in the worksheet.
    worksheet.FreezeRows(0);
}

#Freeze Columns

Call one of the Worksheet.FreezeColumns method overloads to freeze a specific number of columns on the left side of the worksheet.

The following code snippet freezes the first column:

using DevExpress.Spreadsheet;
// ...

using (var workbook = new Workbook()) {
    // Access the first worksheet in the workbook.
    var worksheet = workbook.Worksheets[0];

    // Freeze the first column in the worksheet.
    worksheet.FreezeColumns(0);
}

#Freeze Panes

Call one of the Worksheet.FreezePanes method overloads to freeze a specific number of topmost rows and leftmost columns in the worksheet.

The following code snippet freezes a pane that contains the first row and the first column:

using DevExpress.Spreadsheet;
// ...

using (var workbook = new Workbook()) {
    // Access the first worksheet in the workbook.
    var worksheet = workbook.Worksheets[0];

    // Freeze the first row and the first column in the worksheet.
    worksheet.FreezePanes(0,0);
}

#Unfreeze Panes

Call the Worksheet.UnfreezePanes method to unlock the frozen rows and columns in the worksheet.

worksheet.UnfreezePanes();