Class ExcelTable¶
Namespace: OfficeOpenXml.Table
Assembly: EPPlus.dll
An Excel Table
Inheritance¶
object ← XmlHelper ← ExcelTableDxfBase ← ExcelTable
Implements¶
Inherited Members¶
ExcelTableDxfBase.DataStyle
ExcelTableDxfBase.HeaderRowStyle
ExcelTableDxfBase.TotalsRowStyle
object.Equals(object?, object?)
object.Equals(object?)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object?, object?)
object.ToString()
Properties¶
Address¶
The address of the table
Property Value¶
AutoFilter¶
Autofilter settings for the table
Property Value¶
Columns¶
Collection of the columns in the table
Property Value¶
DataCellStyleName¶
Named style used for the data cells
Property Value¶
HeaderRowBorderStyle¶
Sets differential formatting styles for the table header row border style.
Property Value¶
HeaderRowCellStyle¶
Named style used for the header row
Property Value¶
Name¶
The name of the table object in Excel
Property Value¶
Range¶
The table range
Property Value¶
ShowColumnStripes¶
Display banded columns
Property Value¶
ShowFilter¶
If the header row has an autofilter
Property Value¶
ShowFirstColumn¶
Display special formatting for the first row
Property Value¶
ShowHeader¶
If the header row is visible or not
Property Value¶
ShowLastColumn¶
Display special formatting for the last row
Property Value¶
ShowRowStripes¶
Display banded rows
Property Value¶
ShowTotal¶
If the total row is visible or not
Property Value¶
SortState¶
Gets the sort state of the table. Sort(Action<TableSortOptions>) Sort(TableSortOptions)
Property Value¶
StyleName¶
The style name for custum styles
Property Value¶
TableBorderStyle¶
Sets differential formatting styles for the tables row border style.
Property Value¶
TableStyle¶
The table style. If this property is custom, the style from the StyleName propery is used.
Property Value¶
TableUri¶
The package internal URI to the Table Xml Document.
Property Value¶
Uri
TableXml¶
Provides access to the XML data representing the table in the package.
Property Value¶
XmlDocument
TotalsRowCellStyle¶
Named style used for the total row
Property Value¶
WorkSheet¶
The worksheet of the table
Property Value¶
Methods¶
AddRow(int)¶
Adds new rows to the table.
Parameters¶
rows int
Number of rows to add to the table. Default is 1
Returns¶
CreateHtmlExporter()¶
Creates an IExcelHtmlTableExporter object to export the table to HTML
Returns¶
The exporter object
DeleteRow(int, int)¶
Deletes one or more rows at the specified position in the table.
Parameters¶
position int
The position in the table where the row will be deleted. 0 will delete the first row.
rows int
Number of rows to delete.
Returns¶
Equals(ExcelTable, ExcelTable)¶
Checkes if two tables are the same
Parameters¶
Table 1
Table 2
Returns¶
GetHashCode(ExcelTable)¶
Returns a hashcode generated from the TableXml
Parameters¶
obj ExcelTable
The table
Returns¶
The hashcode
InsertRow(int, int, bool)¶
Inserts one or more rows before the specified position in the table.
Parameters¶
position int
The position in the table where the row will be inserted. Default is in the end of the table. 0 will insert the row at the top. Any value larger than the number of rows in the table will insert a row at the bottom of the table.
rows int
Number of rows to insert.
copyStyles bool
Copy styles from the row above. If inserting a row at position 0, the first row will be used as a template.
Returns¶
The inserted range
SaveToJson(Stream)¶
Saves the table as a JSON string to a string
Parameters¶
stream Stream
The stream to write the JSON to.
SaveToJson(Stream, Action<JsonTableExportSettings>)¶
Saves the table as a JSON string to a string
Parameters¶
stream Stream
The stream to write the JSON to.
settings Action<JsonTableExportSettings>
Settings to configure the JSON output
SaveToJsonAsync(Stream)¶
Save the table to json
Parameters¶
stream Stream
The stream to save to.
Returns¶
SaveToJsonAsync(Stream, Action<JsonTableExportSettings>)¶
Save the table to json
Parameters¶
stream Stream
The stream to save to.
settings Action<JsonTableExportSettings>
Settings for the json output.
Returns¶
SaveToText(FileInfo, ExcelOutputTextFormat)¶
Exports the table to a file
Parameters¶
file FileInfo
The export file
format ExcelOutputTextFormat
Export options
See Also¶
ExcelRangeBase.SaveToText\([FileInfo](https://learn.microsoft.com/dotnet/api/system.io.fileinfo), [ExcelOutputTextFormat](OfficeOpenXml.ExcelOutputTextFormat.md)\)
SaveToText(Stream, ExcelOutputTextFormat)¶
Exports the table to a Stream
Parameters¶
stream Stream
Data will be exported to this stream
format ExcelOutputTextFormat
Export options
See Also¶
ExcelRangeBase.SaveToText\([Stream](https://learn.microsoft.com/dotnet/api/system.io.stream), [ExcelOutputTextFormat](OfficeOpenXml.ExcelOutputTextFormat.md)\)
SaveToTextAsync(Stream, ExcelOutputTextFormat)¶
Exports the table to a Stream
Parameters¶
stream Stream
Data will be exported to this stream
format ExcelOutputTextFormat
Export options
Returns¶
See Also¶
ExcelRangeBase.SaveToText\([Stream](https://learn.microsoft.com/dotnet/api/system.io.stream), [ExcelOutputTextFormat](OfficeOpenXml.ExcelOutputTextFormat.md)\)
SaveToTextAsync(FileInfo, ExcelOutputTextFormat)¶
Exports the table to a file
Parameters¶
file FileInfo
Data will be exported to this stream
format ExcelOutputTextFormat
Export options
Returns¶
See Also¶
ExcelRangeBase.SaveToTextAsync\([FileInfo](https://learn.microsoft.com/dotnet/api/system.io.fileinfo), [ExcelOutputTextFormat](OfficeOpenXml.ExcelOutputTextFormat.md)\)
Sort(TableSortOptions)¶
Sorts the data in the table according to the supplied RangeSortOptions
Parameters¶
options TableSortOptions
Examples¶
var options = new SortOptions();
options.SortBy.Column(0).ThenSortBy.Column(1, eSortDirection.Descending);
Sort(Action<TableSortOptions>)¶
Sorts the data in the table according to the supplied action of RangeSortOptions
Parameters¶
configuration Action<TableSortOptions>
An action with parameters for sorting
Examples¶
ToCollection<T>()¶
Returns a collection of T for the tables data range. The total row is not included. The table must have headers. Headers will be mapped to properties using the name or the objects attributes without white spaces. The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
Returns¶
List<T>
A list of T
Type Parameters¶
T
The type to map to
ToCollection<T>(Action<ToCollectionTableOptions>)¶
Returns a collection of T for the tables data range. The total row is not included. The table must have headers. Headers will be mapped to properties using the name or the property attributes without white spaces. The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
Parameters¶
options Action<ToCollectionTableOptions>
Configures the settings for the function
Returns¶
List<T>
A list of T
Type Parameters¶
T
The type to map to
ToCollection<T>(ToCollectionTableOptions)¶
Returns a collection of T for the tables data range. The total row is not included. The table must have headers. Headers will be mapped to properties using the name or the property attributes without white spaces. The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
Parameters¶
options ToCollectionTableOptions
Settings for the method
Returns¶
List<T>
A list of T
Type Parameters¶
T
The type to map to
ToCollection<T>(Func<ToCollectionRow, T>)¶
Returns a collection of T for the table. If the range contains multiple addresses the first range is used. The the table must have headers. Headers will be mapped to properties using the name or the attributes without white spaces. The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
Parameters¶
setRow Func<ToCollectionRow, T>
The call back function to map each row to the item of type T.
Returns¶
List<T>
A list of T
Type Parameters¶
T
The type to map to
ToCollectionWithMappings<T>(Func<ToCollectionRow, T>, Action<ToCollectionTableOptions>)¶
Returns a collection of T for the table. If the range contains multiple addresses the first range is used. The the table must have headers. Headers will be mapped to properties using the name or the attributes without white spaces. The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
public List<T> ToCollectionWithMappings<T>(Func<ToCollectionRow, T> setRow, Action<ToCollectionTableOptions> options)
Parameters¶
setRow Func<ToCollectionRow, T>
The call back function to map each row to the item of type T.
options Action<ToCollectionTableOptions>
Configures the settings for the function
Returns¶
List<T>
A list of T
Type Parameters¶
T
The type to map to
ToCollectionWithMappings<T>(Func<ToCollectionRow, T>, ToCollectionTableOptions)¶
Returns a collection of T for the table. If the range contains multiple addresses the first range is used. The the table must have headers. Headers will be mapped to properties using the name or the attributes without white spaces. The attributes that can be used are: EpplusTableColumnAttributeBase.Header, DescriptionAttribute.Description or DisplayNameAttribute.Name.
public List<T> ToCollectionWithMappings<T>(Func<ToCollectionRow, T> setRow, ToCollectionTableOptions options)
Parameters¶
setRow Func<ToCollectionRow, T>
The call back function to map each row to the item of type T.
options ToCollectionTableOptions
Configures the settings for the function
Returns¶
List<T>
A list of T
Type Parameters¶
T
The type to map to
ToDataTable()¶
Exports the table to a DataTable
Returns¶
A DataTable containing the data in the table range
See Also¶
ToDataTable(ToDataTableOptions)¶
Exports the table to a DataTable
Parameters¶
options ToDataTableOptions
Returns¶
A DataTable containing the data in the table range
See Also¶
ExcelRangeBase.ToDataTable\([ToDataTableOptions](OfficeOpenXml.Export.ToDataTable.ToDataTableOptions.md)\)
ToDataTable(Action<ToDataTableOptions>)¶
Exports the table to a DataTable
Parameters¶
configHandler Action<ToDataTableOptions>
Returns¶
A DataTable containing the data in the table range
See Also¶
ExcelRangeBase.ToDataTable\([Action](https://learn.microsoft.com/dotnet/api/system.action-1)<[ToDataTableOptions](OfficeOpenXml.Export.ToDataTable.ToDataTableOptions.md)\>\)
ToJson()¶
Returns the table as a JSON string
Returns¶
A string containing the JSON document.
ToJson(Action<JsonTableExportSettings>)¶
Returns the table as a JSON string
Parameters¶
settings Action<JsonTableExportSettings>
Settings to configure the JSON output
Returns¶
A string containing the JSON document.
ToText()¶
Converts the table range to CSV format
Returns¶
See Also¶
ToText(ExcelOutputTextFormat)¶
Converts the table range to CSV format
Parameters¶
format ExcelOutputTextFormat
Parameters/options for conversion to text
Returns¶
See Also¶
ExcelRangeBase.ToText\([ExcelOutputTextFormat](OfficeOpenXml.ExcelOutputTextFormat.md)\)
ToTextAsync()¶
Converts the table range to CSV format
Returns¶
See Also¶
ToTextAsync(ExcelOutputTextFormat)¶
Converts the table range to CSV format
Parameters¶
format ExcelOutputTextFormat
Returns¶
See Also¶
ExcelRangeBase.ToText\([ExcelOutputTextFormat](OfficeOpenXml.ExcelOutputTextFormat.md)\)