Class DefinedNameCollection
Stores defined names for ranges in a workbook.
Inherited Members
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class DefinedNameCollection : IEnumerable<DefinedName>, IEnumerable
Constructors
DefinedNameCollection(Workbook)
Initializes a new instance of the DefinedNameCollection class.
Declaration
public DefinedNameCollection(Workbook workbook)
Parameters
| Type | Name | Description |
|---|---|---|
| Workbook | workbook | The parent workbook. |
Properties
this[int]
Gets the defined name at the specified index.
Declaration
public DefinedName this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index. |
Property Value
| Type | Description |
|---|---|
| DefinedName | The defined name at the specified index. |
Workbook
Exposes the workbook associated with DefinedNameCollection.
Declaration
public Workbook Workbook { get; }
Property Value
| Type | Description |
|---|---|
| Workbook | The workbook returned by the operation. |
Methods
DefineName(string, Range)
Define a name for a range
Declaration
public DefinedName DefineName(string name, Range range)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the defined name |
| Range | range | The range of the defined name |
Returns
| Type | Description |
|---|---|
| DefinedName | The newly created defined name |
DefineName(string, string)
Define a new name for the workbook
Declaration
public DefinedName DefineName(string name, string formula)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the defined name |
| string | formula | The formula of the defined name |
Returns
| Type | Description |
|---|---|
| DefinedName | The new defined name |
GetEnumerator()
Retrieves the requested enumerator from the DefinedNameCollection.
Declaration
public IEnumerator<DefinedName> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<DefinedName> | The get enumerator returned by the operation. |
RemoveDefinendName(string)
Remove a defined name
Declaration
public void RemoveDefinendName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the defined name to remove |
TryGetDefinedName(Sheet, string)
Attempts to get Defined Name and reports whether the operation succeeds.
Declaration
public DefinedName TryGetDefinedName(Sheet sheet, string name)
Parameters
| Type | Name | Description |
|---|---|---|
| Sheet | sheet | |
| string | name |
Returns
| Type | Description |
|---|---|
| DefinedName |
TryGetWorkbookDefinedName(string)
Tries to get a workbook-level defined name by name.
Declaration
public DefinedName TryGetWorkbookDefinedName(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name to look up. |
Returns
| Type | Description |
|---|---|
| DefinedName | The defined name if found, null otherwise. |