Class ExcelNamedRangeCollection
Collection for named ranges
Inheritance
Inherited Members
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public class ExcelNamedRangeCollection : IEnumerable<ExcelNamedRange>, IEnumerable
Properties
Count
The current number of items in the collection
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Indexer for the collection
Declaration
public ExcelNamedRange this[int Index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Index | The index |
Property Value
Type | Description |
---|---|
ExcelNamedRange | The named range |
Item[String]
Name indexer
Declaration
public ExcelNamedRange this[string Name] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | Name | The name (key) for a Named range |
Property Value
Type | Description |
---|---|
ExcelNamedRange | a reference to the range |
Remarks
Throws a KeyNotFoundException if the key is not in the collection.
Methods
Add(String, ExcelRangeBase)
Adds a new named range
Declaration
public ExcelNamedRange Add(string Name, ExcelRangeBase Range)
Parameters
Type | Name | Description |
---|---|---|
System.String | Name | The name |
ExcelRangeBase | Range | The range |
Returns
Type | Description |
---|---|
ExcelNamedRange |
Add(String, ExcelRangeBase, Boolean)
Adds a new named range
Declaration
public ExcelNamedRange Add(string Name, ExcelRangeBase Range, bool allowRelativeAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | Name | The name |
ExcelRangeBase | Range | The range |
System.Boolean | allowRelativeAddress | If true, the address will be retained as it is, if false the address will always be converted to an absolute/fixed address |
Returns
Type | Description |
---|---|
ExcelNamedRange |
AddFormula(String, String)
Add a defined name referencing a formula
Declaration
public ExcelNamedRange AddFormula(string Name, string Formula)
Parameters
Type | Name | Description |
---|---|---|
System.String | Name | |
System.String | Formula |
Returns
Type | Description |
---|---|
ExcelNamedRange |
AddValue(String, Object)
Add a defined name referencing value
Declaration
public ExcelNamedRange AddValue(string Name, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | Name | The name |
System.Object | value | The value for the name |
Returns
Type | Description |
---|---|
ExcelNamedRange |
ContainsKey(String)
Checks collection for the presence of a key
Declaration
public bool ContainsKey(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | key to search for |
Returns
Type | Description |
---|---|
System.Boolean | true if the key is in the collection |
GetEnumerator()
Implement interface method IEnumerator<ExcelNamedRange> GetEnumerator()
Declaration
public IEnumerator<ExcelNamedRange> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ExcelNamedRange> |
Remove(String)
Remove a defined name from the collection
Declaration
public void Remove(string Name)
Parameters
Type | Name | Description |
---|---|---|
System.String | Name | The name |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Implement interface method IEnumeratable GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |