Show / Hide Table of Contents

Class ExcelTableCollection

A collection of table objects

Inheritance
object
ExcelTableCollection
Implements
IEnumerable<ExcelTable>
IEnumerable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OfficeOpenXml.Table
Assembly: EPPlus.dll
Syntax
public class ExcelTableCollection : IEnumerable<ExcelTable>, IEnumerable

Properties

Count

Number of items in the collection

Declaration
public int Count { get; }
Property Value
Type Description
int

this[int]

The table Index. Base 0.

Declaration
public ExcelTable this[int Index] { get; }
Parameters
Type Name Description
int Index
Property Value
Type Description
ExcelTable

this[string]

Indexer

Declaration
public ExcelTable this[string Name] { get; }
Parameters
Type Name Description
string Name

The name of the table

Property Value
Type Description
ExcelTable

The table. Null if the table name is not found in the collection

Methods

Add(ExcelAddressBase, string)

Create a table on the supplied range

Declaration
public ExcelTable Add(ExcelAddressBase Range, string Name)
Parameters
Type Name Description
ExcelAddressBase Range

The range address including header and total row

string Name

The name of the table. Must be unique

Returns
Type Description
ExcelTable

The table object

AddQueryTable(ExcelAddressBase, string, ExcelConnection, params string[])

Adds a new query table to the collection. To add a new query table you need to specify the queries field names.

Declaration
public ExcelTable AddQueryTable(ExcelAddressBase Range, string Name, ExcelConnection connection, params string[] fields)
Parameters
Type Name Description
ExcelAddressBase Range

The range to the table.

string Name

The name of the table

ExcelConnection connection

The connection in the Connections collection.

string[] fields

The names of the fields. EPPlus does not execute the query, so you must set the field names and update the field properties in the Fields collection.

Returns
Type Description
ExcelTable
Exceptions
Type Condition
ArgumentException

If no fields are supplied

InvalidOperationException

If the connection is null or not in the package.

Delete(ExcelTable, bool)

Delete the table and removes it from the collection

Declaration
public void Delete(ExcelTable Table, bool ClearRange = false)
Parameters
Type Name Description
ExcelTable Table

The table object

bool ClearRange

Clear the table range

Delete(int, bool)

Delete the table at the specified index

Declaration
public void Delete(int Index, bool ClearRange = false)
Parameters
Type Name Description
int Index

The index

bool ClearRange

Clear the rage if set to true

Delete(string, bool)

Delete the table with the specified name

Declaration
public void Delete(string Name, bool ClearRange = false)
Parameters
Type Name Description
string Name

The name of the table to be deleted

bool ClearRange

Clear the rage if set to true

GetEnumerator()

Gets the enumerator for the collection

Declaration
public IEnumerator<ExcelTable> GetEnumerator()
Returns
Type Description
IEnumerator<ExcelTable>

The enumerator

GetFromRange(ExcelRangeBase)

Get the table object from a range.

Declaration
public ExcelTable GetFromRange(ExcelRangeBase Range)
Parameters
Type Name Description
ExcelRangeBase Range

The range

Returns
Type Description
ExcelTable

The table. Null if no range matches

Implements

IEnumerable<T>
IEnumerable
In this article
Back to top Generated by DocFX