Interface ITableSheetWriter<TRow>
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
TRowThe 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
namestringThe table name: unique in the workbook, ignoring case, and valid as an Excel name.
columnsIReadOnlyList<string>The column names, written as the header row.
optionsExcelTableOptionsPosition and style. Defaults to Default.
Exceptions
- ArgumentNullException
nameorcolumnsis 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
namestringThe table name: unique in the workbook, ignoring case, and valid as an Excel name.
columnsIReadOnlyList<string>The column names, written as the header row.
optionsExcelTableOptionsPosition and style. Defaults to Default.
ctCancellationTokenA token to cancel the header write.
Returns
Exceptions
- ArgumentNullException
nameorcolumnsis 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.