officefileapi-devexpress-dot-spreadsheet-dot-worksheet-1d2119fb.md
Gets or sets the name of the worksheet .
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
string Name { get; set; }
Property Name As String
| Type | Description |
|---|---|
| String |
A String value which specifies the worksheet name.
|
When naming a worksheet, take into account the following constraints.
To add a new worksheet under the specified name to the workbook, use the WorksheetCollection.Add or WorksheetCollection.Insert method with the worksheet name passed as a parameter.
This example demonstrates how to rename a worksheet. To do this, use the Worksheet.Name property of the corresponding Worksheet object.
// Change the name of the second worksheet.
workbook.Worksheets[1].Name = "Renamed Sheet";
' Change the name of the second worksheet.
workbook.Worksheets(1).Name = "Renamed Sheet"
The following code snippets (auto-collected from DevExpress Examples) contain references to the Name property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-spreadsheet-use-custom-cell-editors/CS/DevAVInvoicing/Form1.cs#L116
Worksheet sheet = spreadsheetControl1.ActiveWorksheet;
if (sheet.Name == "Invoice") {
DefinedName invoiceItems = sheet.DefinedNames.GetDefinedName("InvoiceItems");
// Add a new worksheet under the specified name.
workbook.Worksheets.Add().Name = "TestSheet1";
// Add a new worksheet under the specified name.
workbook.Worksheets.Add().Name = "TestSheet1";
// Add a new worksheet under the specified name.
workbook.Worksheets.Add().Name = "TestSheet1";
{
if (sourceCell != null && e.SheetName == sourceCell.Worksheet.Name)
biFormatPainter.Checked = false;
winforms-spreadsheet-use-custom-cell-editors/VB/DevAVInvoicing/Form1.vb#L107
Dim sheet As Worksheet = spreadsheetControl1.ActiveWorksheet
If Equals(sheet.Name, "Invoice") Then
Dim invoiceItems As DefinedName = sheet.DefinedNames.GetDefinedName("InvoiceItems")
' Add a new worksheet under the specified name.
workbook.Worksheets.Add().Name = "TestSheet1"
' Add a new worksheet under the specified name.
workbook.Worksheets.Add().Name = "TestSheet1"
' Add a new worksheet under the specified name.
workbook.Worksheets.Add().Name = "TestSheet1"
workbook.Worksheets.Add("TestSheet2")
Private Sub Spreadsheet_SheetRemoving(ByVal sender As Object, ByVal e As SheetRemovingEventArgs)
If sourceCell IsNot Nothing AndAlso Equals(e.SheetName, sourceCell.Worksheet.Name) Then biFormatPainter.Checked = False
End Sub
See Also
How to: Move a Worksheet to another Location