Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelWorkbookWriter

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Source revision
e163ccb36643 with working tree changes
Implements
IDisposable
Modifiers
sealed

Writes XLSX worksheets as rows arrive, retaining schemas and workbook metadata rather than source rows.

Inheritance

  • object
  • ExcelWorkbookWriter

Remarks

Each table returns its observed row count and occupied range. Dispose completes the package; file destinations are published only after every table succeeds. Disposing before any table was written throws InvalidOperationException and leaves the destination untouched.

Usage

Explore 1 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.

Returned or exposed by 1

Methods

public void Dispose() #

Completes and publishes a successful workbook, or discards a failed file export.

WriteTable 2 overloads
public ExcelDataSetImportResult WriteTable(string name, DataTable table, CancellationToken cancellationToken = default) #

Writes the rows and schema of an existing data table without copying its rows.

Parameters

name string required
table System.Data.DataTable required
cancellationToken System.Threading.CancellationToken = default optional
public ExcelDataSetImportResult WriteTable(string name, IDataReader reader, CancellationToken cancellationToken = default) #

Writes a forward-only reader in one pass. The caller retains ownership of the reader.

Parameters

name string required
reader System.Data.IDataReader required
cancellationToken System.Threading.CancellationToken = default optional
WriteTable``1 4 overloads
public ExcelDataSetImportResult WriteTable<T>(string name, IEnumerable<T?> rows, CancellationToken cancellationToken = default) #

Writes one worksheet and its table from the readable scalar properties of T.

Type Parameters

T

Parameters

name string required
rows System.Collections.Generic.IEnumerable<T?> required
cancellationToken System.Threading.CancellationToken = default optional
public Task<ExcelDataSetImportResult> WriteTable<T>(string name, IAsyncEnumerable<T?> rows, CancellationToken cancellationToken = default) #

Writes one worksheet from an asynchronous sequence, awaiting and releasing one row at a time.

Type Parameters

T

Parameters

name string required
rows System.Collections.Generic.IAsyncEnumerable<T?> required
cancellationToken System.Threading.CancellationToken = default optional
public ExcelDataSetImportResult WriteTable<T>(string name, IEnumerable<T?> rows, IReadOnlyList<string> headers, Action<ExcelTabularRowWriter, T?> writeRow, CancellationToken cancellationToken = default) #

Writes a single-pass sequence using an explicit column schema and a row callback.

Type Parameters

T

Parameters

name string required
rows System.Collections.Generic.IEnumerable<T?> required
headers System.Collections.Generic.IReadOnlyList<string> required
writeRow System.Action<OfficeIMO.Excel.ExcelDocument.ExcelTabularRowWriter, T?> required
cancellationToken System.Threading.CancellationToken = default optional
public Task<ExcelDataSetImportResult> WriteTable<T>(string name, IAsyncEnumerable<T?> rows, IReadOnlyList<string> headers, Action<ExcelTabularRowWriter, T?> writeRow, CancellationToken cancellationToken = default) #

Writes an asynchronous single-pass sequence using an explicit schema and a row callback.

Type Parameters

T

Parameters

name string required
rows System.Collections.Generic.IAsyncEnumerable<T?> required
headers System.Collections.Generic.IReadOnlyList<string> required
writeRow System.Action<OfficeIMO.Excel.ExcelDocument.ExcelTabularRowWriter, T?> required
cancellationToken System.Threading.CancellationToken = default optional