Table of Contents

Class XlsxTable

Namespace
DocToolkit
Assembly
DocToolkit.Xlsx.dll

An Excel table (a ListObject, what a spreadsheet user means by "make this a table"): a named, banded range with an autofilter and structured references a formula elsewhere in the workbook can use.

public sealed class XlsxTable
Inheritance
XlsxTable
Inherited Members

Remarks

This does not make AppendRows(byte[], string, IEnumerable<IEnumerable<object?>>) keep the table current, and that is measured rather than assumed. AppendRows writes with a raw cell value at the sheet's last used row — it has no awareness of any table on the sheet, and ClosedXML does not retroactively absorb an adjacent cell write into a table's range on its own. A row appended after this table sits adjacent to it, not inside it, until the table is recreated over the new range. This is the identical shape of caveat AddPivotTable(byte[], string, string, string, string, IEnumerable<string>, IEnumerable<PivotDataField>, IEnumerable<string>?, IEnumerable<string>?, bool, bool) already carries for its own result grid — a real, measured limitation stated here rather than left to be discovered.

Properties

Name

The table's name — what a formula elsewhere in the workbook uses for a structured reference, such as Sales[Total].

public string Name { get; }

Property Value

string

Range

The cells this table covers, header row included, such as A1:C10.

public string Range { get; }

Property Value

string

Style

The built-in style tier applied to the table.

public XlsxTableStyle Style { get; }

Property Value

XlsxTableStyle

Methods

Named(string, string, XlsxTableStyle)

Names a range as a table.

public static XlsxTable Named(string range, string name, XlsxTableStyle style = XlsxTableStyle.Medium)

Parameters

range string

The cells this table covers, header row included, such as A1:C10.

name string

The table's name. Must be a valid Excel name: it cannot contain a space, and cannot look like a cell reference such as A1.

style XlsxTableStyle

The built-in style tier to apply. Defaults to Medium.

Returns

XlsxTable

Exceptions

ArgumentNullException

range or name is null.

ArgumentException

range or name is blank, or range names a sheet.