冻结和取消冻结窗格
Contents
[
Hide
]
本主题解释了如何冻结和解冻行和列。冻结列或行允许用户在滚动到工作表的其他部分时保持列标题或行标题可见。在处理包含大量数据的工作表时,此功能非常有帮助。当用户滚动时,只有数据被向下滚动,标题保持在原位,使数据更易于阅读。分栏冻结功能仅支持Internet Explorer 6.0以上版本。
冻结行和列
要冻结指定数量的行和列:
- 将 Aspose.Cells.GridWeb 控件添加到 Web 表单中。
- 访问工作表。
- 冻结若干行和列。
还可以使用界面冻结特定数量的行和列。右键单击要冻结行和列的单元格,然后从列表中选择冻结。
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); |
取消冻结行和列
要取消冻结行和列:
- 将 Aspose.Cells.GridWeb 控件添加到 Web 表单中。
- 访问工作表。
- 取消冻结行和列。
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(); |