NamedRangeCollection Class
Collection of the descriptive names which are used to represent cells, ranges of cells, formulas, or constant values.
public sealed class NamedRangeCollection : IEnumerable<NamedRange>, IEnumerable
Public NotInheritable Class NamedRangeCollection
Implements IEnumerable(Of NamedRange), IEnumerable
- Inheritance:
- System.ObjectNamedRangeCollection
Remarks
You can use the labels of columns and rows on a worksheet to refer to the cells within those columns and rows. Or you can create descriptive names to represent cells, ranges of cells, formulas, or constant values. Labels can be used in formulas that refer to data on the same worksheet; if you want to represent a range on another worksheet, use a name. You can also create 3-D names that represent the same cell or range of cells across multiple worksheets.
Properties
Count
Gets the number of named ranges contained in the collection.
Property Value
- System.Int32
Item[Int32]
Gets the NamedRange at the specified index.
public NamedRange this[int index] { get; }
Public ReadOnly Property Item(index As Integer) As NamedRange
Parameters
index
- System.Int32
Range index.
Property Value
Item[String]
Gets the NamedRange with the specified name.
public NamedRange this[string name] { get; }
Public ReadOnly Property Item(name As String) As NamedRange
Parameters
name
- System.String
Range name.
Property Value
Methods
Add(String, CellRange)
Adds a new named range. Named ranges are used to represent cells, ranges of cells, formulas or constant values.
public void Add(string name, CellRange range)
Public Sub Add(name As String, range As CellRange)
Parameters
name
- System.String
The user-defined name.
range
- CellRange
The range to be referred by name.
Remarks
You can use the labels of columns and rows on a worksheet to refer to the cells within those columns and rows. Or you can create descriptive names to represent cells, ranges of cells, formulas, or constant values. Labels can be used in formulas that refer to data on the same worksheet; if you want to represent a range on another worksheet, use a name. You can also create 3-D names that represent the same cell or range of cells across multiple worksheets.
See Also
Add(String, CellRange, Boolean)
Adds a new named range. Named ranges are used to represent cells, ranges of cells, formulas or constant values.
public void Add(string name, CellRange range, bool globalName)
Public Sub Add(name As String, range As CellRange, globalName As Boolean)
Parameters
name
- System.String
The user-defined name.
range
- CellRange
The range to be referred by name.
globalName
- System.Boolean
sets the range as global if set to true
Remarks
You can use the labels of columns and rows on a worksheet to refer to the cells within those columns and rows. Or you can create descriptive names to represent cells, ranges of cells, formulas, or constant values. Labels can be used in formulas that refer to data on the same worksheet; if you want to represent a range on another worksheet, use a name. You can also create 3-D names that represent the same cell or range of cells across multiple worksheets.
See Also
GetEnumerator()
Returns an enumerator that can iterate through a collection.
public IEnumerator<NamedRange> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of NamedRange)
Returns
- System.Collections.Generic.IEnumerator<NamedRange>
An System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection.
SetPrintArea(CellRange)
Sets print area.
Parameters
range
- CellRange
Range of cells that we want set as print area.
Remarks
If specified, print area is used when exporting to HTML, PDF, XPS, and image formats as cell range which will be exported in the output file format.
SetPrintArea(CellRange[])
Sets multi-range print area.
Multi-range print area is currently supported in XLSX only.
public void SetPrintArea(params CellRange[] ranges)
Public Sub SetPrintArea(ParamArray ranges As CellRange())
Parameters
ranges
- CellRange[]
Ranges of cells that we want set as print area.
Remarks
If specified, print area is used when exporting to HTML, PDF, XPS, and image formats as cell range which will be exported in the output file format.
SetPrintArea(IEnumerable<CellRange>)
Sets multi-range print area.
Multi-range print area is currently supported in XLSX only.
public void SetPrintArea(IEnumerable<CellRange> ranges)
Public Sub SetPrintArea(ranges As IEnumerable(Of CellRange))
Parameters
ranges
- System.Collections.Generic.IEnumerable<CellRange>
Ranges of cells that we want set as print area.
Remarks
If specified, print area is used when exporting to HTML, PDF, XPS, and image formats as cell range which will be exported in the output file format.
SetPrintTitles(ExcelColumn, Int32)
Sets print titles (columns to repeat at left).
public void SetPrintTitles(ExcelColumn startColumn, int numberOfColumns)
Public Sub SetPrintTitles(startColumn As ExcelColumn, numberOfColumns As Integer)
Parameters
startColumn
- ExcelColumn
First column.
numberOfColumns
- System.Int32
Number of columns that repeat.
SetPrintTitles(ExcelColumnRowBase, Int32, ExcelColumnRowBase, Int32)
Sets print titles.
public void SetPrintTitles(ExcelColumnRowBase startRow, int numberOfRows, ExcelColumnRowBase startColumn, int numberOfColumns)
Public Sub SetPrintTitles(startRow As ExcelColumnRowBase, numberOfRows As Integer, startColumn As ExcelColumnRowBase, numberOfColumns As Integer)
Parameters
startRow
- ExcelColumnRowBase
First row.
numberOfRows
- System.Int32
Number of rows that repeat.
startColumn
- ExcelColumnRowBase
First column.
numberOfColumns
- System.Int32
Number of columns that repeat.
SetPrintTitles(ExcelRow, Int32)
Sets print titles (rows to repeat at top).
public void SetPrintTitles(ExcelRow startRow, int numberOfRows)
Public Sub SetPrintTitles(startRow As ExcelRow, numberOfRows As Integer)
Parameters
startRow
- ExcelRow
First row.
numberOfRows
- System.Int32
Number of rows that repeat.