Remove a Worksheet
Contents
[
Hide
]
This topic discusses removing worksheets using the Aspose.Cells.GridDesktop control. There are a few simple approaches to accomplish this basic task.
Removing a Worksheet
To remove a worksheet using Aspose.Cells.GridDesktop control, please follow the steps below:
- Add the Aspose.Cells.GridDesktop control to a form.
- Call the Worksheets collection’s Remove method in the GridDesktop control.
Using Worksheet Index
In this approach, simply pass the worksheet index (in the worksheets collection of the grid) of the worksheet to be removed.
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 | |
// Removing a worksheet using its index | |
gridDesktop1.Worksheets.Remove(0); |
Using Worksheet Name
If the name of the worksheet is known, it is possible to remove a specific worksheet by specifying its name.
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 | |
// Removing a worksheet using its index | |
gridDesktop1.Worksheets.RemoveAt("Sheet3"); |
Remove is a method. Use it to remove a worksheet using its index (in the worksheets collection) or use RemoveAt method to remove the worksheet using its index/name.