删除工作表
Contents
[
Hide
]
本主题讨论使用 Aspose.Cells.GridDesktop 控件删除工作表。有几种简单的方法可以完成这项基本任务。
删除工作表
要使用 Aspose.Cells.GridDesktop 控件删除工作表,请按照以下步骤操作:
- 将 Aspose.Cells.GridDesktop 控件添加到窗体。
- 在 GridDesktop 控件中调用 Worksheets 集合的 Remove 方法。
使用工作表索引
在这种方法中,只需传递要删除的工作表的工作表索引(在网格的工作表集合中)。
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 | |
// Removing a worksheet using its index | |
gridDesktop1.Worksheets.Remove(0); |
使用工作表名称
如果已知工作表的名称,则可以通过指定其名称来删除特定的工作表。
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 | |
// Removing a worksheet using its index | |
gridDesktop1.Worksheets.RemoveAt("Sheet3"); |
删除是一种方法。使用它可以使用其索引(在工作表集合中)删除工作表,或使用 RemoveAt 方法使用其索引/名称删除工作表。