Freeze Unfreeze Rows and Columns

Freezing Columns

To freeze columns of a worksheet using Aspose.Cells.GridDesktop, please follow the steps below:

  • Access any desired Worksheet
  • Set the number of Frozen Columns in the Worskheet
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the worksheet of the Grid that is currently active
Worksheet sheet = gridDesktop1.GetActiveWorksheet();
// Setting the number of frozen columns to 2
sheet.FrozenCols = 2;

Un-Freezing Columns

To unfreeze columns of a worksheet using Aspose.Cells.GridDesktop, please follow the steps below:

  • Access any desired Worksheet
  • Set the number of Frozen Columns in the Worskheet to Zero (0). It will produce the effect of unfrozen columns
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the worksheet of the Grid that is currently active
Worksheet sheet = gridDesktop1.GetActiveWorksheet();
// Setting the number of frozen columns to 0 for unfreezing columns
sheet.FrozenCols = 0;

Freezing Rows

To freeze rows of a worksheet using Aspose.Cells.GridDesktop, please follow the steps below:

  • Access any desired Worksheet
  • Set the number of Frozen Rows in the Worskheet
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the worksheet of the Grid that is currently active
Worksheet sheet = gridDesktop1.GetActiveWorksheet();
// Setting the number of frozen rows to 2
sheet.FrozenRows = 2;

Un-Freezing Rows

To unfreeze rows of a worksheet using Aspose.Cells.GridDesktop, please follow the steps below:

  • Access any desired Worksheet
  • Set the number of Frozen Rows in the Worskheet to Zero (0). It will produce the effect of unfrozen rows
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the worksheet of the Grid that is currently active
Worksheet sheet = gridDesktop1.GetActiveWorksheet();
// Setting the number of frozen rows to 0 for unfreezing rows
sheet.FrozenRows = 0;