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:
- System.ObjectTableCollection
Properties
Count
Gets the number of Tables contained in the collection.
Property Value
- System.Int32
The number of Tables contained in the collection.
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
index
- System.Int32
The zero-based index of the Table.
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
- System.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
name
- System.String
The name of the Table.
hasHeaders
- System.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
- System.ArgumentNullException
range
is null.
- System.ArgumentException
range
doesn't belong to the parent worksheet.
- System.InvalidOperationException
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
name
- System.String
The name of the Table.
range
- System.String
The Table cell range.
hasHeaders
- System.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
- System.Collections.Generic.IEnumerator<Table>
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
- System.Boolean
True
if Table was removed from the collection; otherwise, false
.
Exceptions
- System.ArgumentNullException
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
- System.Int32
The table index.
direction
- RemoveShiftDirection
The removal shift direction.