Table of Contents

Interface ITableSheetWriter<TRow>

Namespace
ExcelReader.Core.Writer
Assembly
ExcelReader.Core.dll

A sheet writer that can write Excel tables (ranges formatted with "Format as Table"). Implemented by the XLSX and XLSB sheet writers.

public interface ITableSheetWriter<TRow> : ISheetWriter<TRow>, IDisposable, IAsyncDisposable

Type Parameters

TRow

The concrete row writer type.

Inherited Members

Remarks

Only ExcelReader implements this interface, and a minor version can add members to it. See versioning and compatibility.

Methods

BeginTable(string, IReadOnlyList<string>, ExcelTableOptions?)

Writes a header row with columns at the sheet's next row and opens a table there. The table covers every row written until EndTable() or the end of the sheet.

void BeginTable(string name, IReadOnlyList<string> columns, ExcelTableOptions? options = null)

Parameters

name string

The table name: unique in the workbook, ignoring case, and valid as an Excel name.

columns IReadOnlyList<string>

The column names, written as the header row.

options ExcelTableOptions

Position and style. Defaults to Default.

Exceptions

ArgumentNullException

name or columns is null.

ArgumentException

The name, a column name or the style is not valid, or the name is already used in this workbook.

ArgumentOutOfRangeException

FirstColumn is negative.

InvalidOperationException

A table is already open on this sheet, or a row is still active.

ObjectDisposedException

The sheet has already been ended.

ExcelLimitExceededException

The sheet has no room left for a header row and a data row.

BeginTableAsync(string, IReadOnlyList<string>, ExcelTableOptions?, CancellationToken)

Writes a header row with columns at the sheet's next row and opens a table there. The table covers every row written until EndTable() or the end of the sheet.

ValueTask BeginTableAsync(string name, IReadOnlyList<string> columns, ExcelTableOptions? options = null, CancellationToken ct = default)

Parameters

name string

The table name: unique in the workbook, ignoring case, and valid as an Excel name.

columns IReadOnlyList<string>

The column names, written as the header row.

options ExcelTableOptions

Position and style. Defaults to Default.

ct CancellationToken

A token to cancel the header write.

Returns

ValueTask

Exceptions

ArgumentNullException

name or columns is null.

ArgumentException

The name, a column name or the style is not valid, or the name is already used in this workbook.

ArgumentOutOfRangeException

FirstColumn is negative.

InvalidOperationException

A table is already open on this sheet, or a row is still active.

ObjectDisposedException

The sheet has already been ended.

ExcelLimitExceededException

The sheet has no room left for a header row and a data row.

EndTable()

Closes the open table at the last row written. Writes nothing; the table is stored when the sheet ends.

void EndTable()

Exceptions

InvalidOperationException

No table is open on this sheet.

ObjectDisposedException

The sheet has already been ended.