Class DefinedName
Represents a named range or formula in a workbook.
Inherited Members
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class DefinedName
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Examples
// Create a named range
var name = workbook.DefinedNames.Add("SalesTotal", "=SUM(Sheet1!A1:A100)");
Fields
_workbook
Exposes the workbook associated with DefinedName.
Declaration
protected Workbook _workbook
Field Value
| Type | Description |
|---|---|
| Workbook | The workbook returned by the operation. |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Properties
BuiltIn
Gets whether the defined name is a built-in defined name.
Declaration
public bool BuiltIn { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Comment
Get or set the comment of the defined name.
Declaration
public string Comment { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
CustomMenu
Get or set the custom menu text of the defined name.
Declaration
public string CustomMenu { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Description
Get or set the description.
Declaration
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Formula
Get or set the formula of the defined name
Declaration
public string Formula { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Help
Get or set the help text
Declaration
public string Help { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
LocalSheet
Specifies the local sheet for the defined name.
Declaration
public Sheet LocalSheet { get; set; }
Property Value
| Type | Description |
|---|---|
| Sheet |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
LocaleSheetName
Specifies the locale sheet name.
Declaration
public string LocaleSheetName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Name
Get or set the name of the defined name.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
Range
Gets the range referenced by this defined name.
Declaration
public Range Range { get; }
Property Value
| Type | Description |
|---|---|
| Range |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
ShortcutKey
Specifies the shortcut key for the defined name.
Declaration
public string ShortcutKey { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
StatusBar
Specifies the status bar text for the defined name.
Declaration
public string StatusBar { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Value
Get the actual value of the defined name
Declaration
public object Value { get; }
Property Value
| Type | Description |
|---|---|
| object |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.
Methods
IsValidName(string)
Indicates whether the valid name condition is true for the DefinedName.
Declaration
protected static bool IsValidName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name used by the operation. |
Returns
| Type | Description |
|---|---|
| bool | The is valid name returned by the operation. |
Remarks
A DefinedName binds a descriptive name to a cell range, formula, or constant value.
Names can be workbook-scoped (available across all sheets) or worksheet-scoped (local to a sheet).
Defined names are useful for creating readable formulas and for referencing ranges dynamically.