TableCollection Class
A collection of Table items. Supported in XLSX only.
public sealed class TableCollection : IEnumerable<Table>, IEnumerable
Public NotInheritable Class TableCollection
Implements IEnumerable(Of Table), IEnumerable
- Inheritance:
- TableCollection
Properties
Count
Gets the number of Tables contained in the collection.
Property Value
Item[Int32]
Gets the Table at the specified index.
public Table this[int index] { get; }
Public ReadOnly Property Item(index As Integer) As Table
Parameters
Property Value
Item[String]
Gets Table described by name from the collection.
public Table this[string name] { get; }
Public ReadOnly Property Item(name As String) As Table
Parameters
name
- String
Name of the table.
Property Value
Methods
Add(String, CellRange, Boolean)
Adds a new Table to the collection.
public Table Add(string name, CellRange range, bool hasHeaders)
Public Function Add(name As String, range As CellRange, hasHeaders As Boolean) As Table
Parameters
hasHeaders
- Boolean
Specifies whether the range contains a header row.
Returns
Remarks
Method creates and adds a new table to the worksheet. If hasHeaders
is true
first row in specified range will be used as header row; otherwise, table's range will be expanded by inserting a header row.
Exceptions
range
is null.
- System.ArgumentException
range
doesn't belong to the parent worksheet.
Table or DefinedName with same name already exists.
Add(String, String, Boolean)
Adds a new Table to the collection.
public Table Add(string name, string range, bool hasHeaders)
Public Function Add(name As String, range As String, hasHeaders As Boolean) As Table
Parameters
hasHeaders
- Boolean
Specifies whether the range contains a header row.
Returns
Remarks
Method creates and adds a new table to the worksheet. If hasHeaders
is true
first row in specified range will be used as header row; otherwise, table's range will be expanded by inserting a header row.
GetEnumerator()
Gets the collection enumerator.
public IEnumerator<Table> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of Table)
Returns
The collection enumerator.
Remove(Table, RemoveShiftDirection)
Removes the specified Table.
public bool Remove(Table table, RemoveShiftDirection direction)
Public Function Remove(table As Table, direction As RemoveShiftDirection) As Boolean
Parameters
table
- Table
The table.
direction
- RemoveShiftDirection
The removal shift direction.
Returns
Exceptions
table
is null.
RemoveAt(Int32, RemoveShiftDirection)
Removes the Table at the specified index.
public void RemoveAt(int index, RemoveShiftDirection direction)
Public Sub RemoveAt(index As Integer, direction As RemoveShiftDirection)
Parameters
index
- Int32
The table index.
direction
- RemoveShiftDirection
The removal shift direction.