重命名工作表
Contents
[
Hide
]
本主题讨论如何使用 Aspose.Cells.GridDesktop 更改工作表的名称。
例子
重命名工作表是一项非常有用的简单任务。例如,如果您想要标记工作表,以便每个工作表包含的内容一目了然。例如,一个模型可能有 12 个工作表,每个工作表都按月份命名,以保存费用信息。
要使用 Aspose.Cells.GridDesktop 控件重命名工作表:
- 将 Aspose.Cells.GridDesktop 控件添加到窗体。
- 获取所需工作表的引用。
- 使用其引用设置工作表的名称。
This file contains hidden or 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"; |
在更改工作表的名称之前,需要访问该工作表的引用。有许多方法可以访问工作表引用。要了解这些方法,请参阅访问工作表.