重命名工作表
Contents
[
Hide
]
在 Aspose.Cells.GridWeb 中处理许多工作表并决定更改它们的名称以使它们更有意义时,重命名工作表可能非常有用。例如,可以将包含发票的工作表重命名为 Invoice 而不是 Sheet1。本主题描述了这个简单但有用的功能。
重命名工作表
所有工作表都包含一个名称属性,允许开发人员访问或修改工作表的名称。要重命名工作表:
- 从 GridWorksheetCollection 访问工作表。
- 重命名选定的工作表。
Aspose.Cells.GridWeb中工作表的访问方法请参考访问工作表.
在执行代码之前,工作表有一个默认名称,例如 Sheet1。
输入文件:默认名称为 Sheet1 的工作表
运行代码后,工作表被重命名为 Students。
输出:工作表重命名为 Students
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 | |
// Renaming a worksheet | |
GridWeb1.WorkSheets[0].Name = "Students"; |