Freeze and Unfreeze Panes
Contents
[
Hide
]
This topic explains how to freeze and unfreeze rows and columns. Freezing columns or rows allows users to keep the column headings or row titles visible while they scroll to other parts of the worksheet. This feature is very helpful when working with worksheets that contain large volumes of data. When users scroll only data is scrolled down and the headings stay in place, making the date easier to read. The freeze panes feature is only supported in Internet Explorer 6.0 or above.
Freezing Rows & Columns
To freeze a specific number of rows and columns:
- Add the Aspose.Cells.GridWeb control to a Web Form.
- Access a worksheet.
- Freeze a number of rows & columns.
It is also possible to freeze a specific number of rows & columns using the interface. Right-click a cell where you want to freeze rows & columns and select Freeze from the list.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Get user inputs for row, column, number of rows and number of columns | |
int row = Convert.ToInt16(txtRow.Text.Trim()); | |
int column = Convert.ToInt16(txtColumn.Text.Trim()); | |
int noOfRows = Convert.ToInt16(txtNoOfRows.Text.Trim()); | |
int noOfColumns = Convert.ToInt16(txtNoOfColumns.Text.Trim()); | |
// Accessing the reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Freeze desired rows and columns | |
sheet.FreezePanes(row, column, noOfRows, noOfColumns); |
Unfreezing Rows & Columns
To unfreeze rows and columns:
- Add the Aspose.Cells.GridWeb control to a Web Form.
- Access a worksheet.
- Unfreeze rows & columns.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing the reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Unfreezing rows and columns | |
sheet.UnFreezePanes(); |