冻结和取消冻结窗格

冻结行和列

要冻结指定数量的行和列:

  1. 将 Aspose.Cells.GridWeb 控件添加到 Web 表单中。
  2. 访问工作表。
  3. 冻结若干行和列。
// 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);

取消冻结行和列

要取消冻结行和列:

  1. 将 Aspose.Cells.GridWeb 控件添加到 Web 表单中。
  2. 访问工作表。
  3. 取消冻结行和列。
// 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();