Rename a Worksheet
Contents
[
Hide
]
This topic discusses how to change the name of a worksheet using Aspose.Cells.GridDesktop.
Example
Renaming a worksheet is a simple task that can be very useful. For example, if you want to label worksheets so that it is obvious what each one contains. For example, a model might have 12 worksheets, each named by month, to hold expense information.
To rename a worksheet using Aspose.Cells.GridDesktop control:
- Add a Aspose.Cells.GridDesktop control to a form.
- Get the reference of a desired worksheet.
- Set the name of the worksheet using its reference.
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"; |
Before changing the name of the worksheet, it’s required to access the reference of that worksheet. There are many ways to access a worksheet reference. To learn about those ways, please refer to Accessing Worksheets.