Table of Contents

Class XlsxRowWriter

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

Writes the cells of a single worksheet row into an XLSX row buffer; reused across rows by XlsxSheetWriter.

public sealed class XlsxRowWriter : IRowWriter, IDisposable, IAsyncDisposable
Inheritance
XlsxRowWriter
Implements
Inherited Members

Methods

Dispose()

Synchronous counterpart to DisposeAsync(): ends the row and, on the rare buffer-threshold flush, writes to the destination stream synchronously.

public void Dispose()

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

Skip(int)

Advances past count columns without writing any cell for them, leaving them blank when the row is read back.

public void Skip(int count = 1)

Parameters

count int

The number of columns to skip; must not be negative.

Exceptions

ObjectDisposedException

The row has already been disposed.

ArgumentOutOfRangeException

count is negative.

ExcelLimitExceededException

Skipping would advance past Excel's 16,384-column limit.

Write(bool)

Writes a boolean cell.

public void Write(bool value)

Parameters

value bool

The value to write.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write(DateOnly)

Writes a date-only cell (no time component).

public void Write(DateOnly value)

Parameters

value DateOnly

The value to write.

Remarks

Shares the DateTime date-serial cell format (midnight), so it round-trips as a date.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write(DateTime)

Writes a date/time cell.

public void Write(DateTime value)

Parameters

value DateTime

The value to write.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write(bool?)

Writes a boolean cell, or a blank/empty cell if value is null.

public void Write(bool? value)

Parameters

value bool?

The value to write.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write(DateOnly?)

Writes a date-only cell, or a blank/empty cell if value is null.

public void Write(DateOnly? value)

Parameters

value DateOnly?

The value to write.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write(DateTime?)

Writes a date/time cell, or a blank/empty cell if value is null.

public void Write(DateTime? value)

Parameters

value DateTime?

The value to write.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write(TimeOnly?)

Writes a time-of-day cell, or a blank/empty cell if value is null.

public void Write(TimeOnly? value)

Parameters

value TimeOnly?

The value to write.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write(string?)

Writes a text cell, or a blank/empty cell if value is null.

public void Write(string? value)

Parameters

value string

The text to write.

Exceptions

ArgumentException

value exceeds Excel's per-cell text limit (32,767 characters).

ObjectDisposedException

The row has already been disposed.

ArgumentException

value exceeds Excel's 32,767-character per-cell limit.

Write(TimeOnly)

Writes a time-of-day cell (no date component).

public void Write(TimeOnly value)

Parameters

value TimeOnly

The value to write.

Remarks

Written as an Excel time serial: the fraction of a 24h day, in [0,1). This is a plain number cell (no date style); ExcelParser<T> reconstructs the TimeOnly from the fraction.

Exceptions

ObjectDisposedException

The row has already been disposed.

WriteUtf8(ReadOnlySpan<byte>)

Writes a text cell from UTF-8 bytes, producing exactly the cell Write(string?) would for the decoded text. Writers whose output is UTF-8 copy plain text through without materializing a string; the default implementation decodes and delegates.

public void WriteUtf8(ReadOnlySpan<byte> utf8)

Parameters

utf8 ReadOnlySpan<byte>

The UTF-8 encoded text to write. Invalid sequences are replaced as UTF8 decoding would.

Exceptions

ArgumentException

The decoded text exceeds Excel's per-cell text limit (32,767 characters).

ObjectDisposedException

The row has already been disposed.

Write<T>(T?)

Writes a numeric cell, or a blank/empty cell if value is null.

public void Write<T>(T? value) where T : struct, IUtf8SpanFormattable

Parameters

value T?

The value to write.

Type Parameters

T

The underlying numeric value type to write.

Exceptions

ObjectDisposedException

The row has already been disposed.

Write<T>(T)

Writes a numeric cell for any UTF-8-formattable value type (e.g. int, double, decimal).

public void Write<T>(T value) where T : IUtf8SpanFormattable

Parameters

value T

The value to write.

Type Parameters

T

The numeric value type to write.

Exceptions

ObjectDisposedException

The row has already been disposed.