重命名工作表
Contents
[
Hide
]
本主题讨论了如何使用 Aspose.Cells.GridDesktop 更改工作表的名称。
示例
重命名工作表是一项简单的任务,但可能非常有用。 例如,如果要为工作表加上标签,以便清楚地知道每个工作表包含的内容。 例如,模型可能有 12 个以月份命名的工作表,用于保存费用信息。
要使用 Aspose.Cells.GridDesktop 控件重命名工作表:
- 在表单中添加 Aspose.Cells.GridDesktop 控件。
- 获取所需工作表的引用。
- 使用其引用设置工作表的名称。
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 | |
// Accesing an active worksheet directly | |
Worksheet sheet = gridDesktop1.GetActiveWorksheet(); | |
// Renaming a worksheet | |
sheet.Name = "Renamed Sheet"; |
在更改工作表名称之前,需要访问该工作表的引用。 有许多方法可以访问工作表的引用。 要了解这些方法,请参阅访问工作表。