officefileapi-devexpress-dot-spreadsheet-dot-worksheet-acebfaa2.md
Gets or sets the worksheet’s code name.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
string CodeName { get; set; }
Property CodeName As String
| Type | Description |
|---|---|
| String |
The code name.
|
Use the CodeName property to specify an internal worksheet name that does not change when a user renames the worksheet.
The following method returns a worksheet with the specified code name:
using DevExpress.Spreadsheet;
using System.Linq;
// ...
private Worksheet GetSheetByCodeName(IWorkbook workbook, string codeName) {
return workbook.Worksheets.SingleOrDefault(x => x.CodeName == codeName);
}
Imports DevExpress.Spreadsheet
Imports System.Linq
' ...
Private Function GetSheetByCodeName(ByVal workbook As IWorkbook, ByVal codeName As String) As Worksheet
Return workbook.Worksheets.SingleOrDefault(Function(x) x.CodeName = codeName)
End Function
You can also use the WorksheetCollection.Item property to access a worksheet by its index or name. See the following help topic for details: How to: Access a Worksheet.
See Also