Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelTable

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Source revision
273d35d5ba8a with working tree changes
Modifiers
sealed

Lightweight object model wrapper for an Excel table.

Inheritance

  • object
  • ExcelTable

Usage

Explore 15 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Methods

public ExcelTable AppendDataTable(DataTable table) #

Appends rows from a data table to the Excel table.

Parameters

table System.Data.DataTable required

Returns

ExcelTable
public ExcelRange AsRange() #

Returns the table as a range wrapper.

Returns

ExcelRange
public ExcelTable ClearTotals() #

Clears totals row settings from the table.

Returns

ExcelTable
public ExcelRange Column(string headerName, bool includeHeader = false, bool normalizeHeader = true) #

Resolves a data-column range in this table by its header text.

Parameters

headerName string required
includeHeader bool = false optional
normalizeHeader bool = true optional

Returns

ExcelRange
public ExcelTable Rename(string newName, ExcelTableNameValidationMode validationMode = Strict) #

Renames this table and its workbook references.

Parameters

newName string required
validationMode OfficeIMO.Excel.ExcelTableNameValidationMode = Strict optional

Returns

ExcelTable
public ExcelTable Resize(string newRange) #

Resizes the table, preserving current column names where possible.

Parameters

newRange string required

Returns

ExcelTable
public IEnumerable<T> RowsAs<T>(ExcelReaderOptions? options = null, CancellationToken cancellationToken = default) #

Streams this table's data rows as typed models, using its column schema. Header and totals rows are excluded, including for tables with hidden headers. Enumerate while the owning workbook remains open; unsaved edits are included.

Type Parameters

T

Parameters

options OfficeIMO.Excel.ExcelReaderOptions? = null optional
Conversion, culture and safety options for reading the values.
cancellationToken System.Threading.CancellationToken = default optional
Cancels table discovery and row enumeration.

Returns

IEnumerable<T>
public ExcelTable SetSchema(IReadOnlyList<string> columnNames, string? newRange = null) #

Replaces the table's ordered column schema and optionally resizes its range.

Parameters

columnNames System.Collections.Generic.IReadOnlyList<string> required
newRange string? = null optional

Returns

ExcelTable
public ExcelTable SetStyle(ExcelTableStyle style, bool? showFirstColumn = null, bool? showLastColumn = null, bool? showRowStripes = null, bool? showColumnStripes = null) #

Applies a built-in table style and optional style flags.

Parameters

style OfficeIMO.Excel.ExcelTableStyle required
showFirstColumn bool? = null optional
showLastColumn bool? = null optional
showRowStripes bool? = null optional
showColumnStripes bool? = null optional

Returns

ExcelTable
public ExcelTable SetTotals(IDictionary<string, ExcelTableTotalsFunction> byHeader) #

Applies totals row functions by header name.

Parameters

byHeader System.Collections.Generic.IDictionary<string, OfficeIMO.Excel.ExcelTableTotalsFunction> required

Returns

ExcelTable
public ExcelTable SortByColumn(int columnOffset, bool ascending = true) #

Sorts table rows by a 1-based column offset.

Parameters

columnOffset int required
ascending bool = true optional

Returns

ExcelTable

Properties

public ExcelSheet Sheet { get; } #

Gets the worksheet that owns the table.

public string NameOrRange { get; } #

Gets the table name, display name, or A1 range used to locate the table.

public string? Range { get; } #

Gets the table range when it can be resolved.