Class OdsStreamWriter
- Namespace
- OdfKit.Spreadsheet
- Assembly
- OdfKit.dll
Writes ODS spreadsheets with strict sequential sheet calls for high-performance, low-memory output. 提供以資料流方式寫入 ODS 試算表文件的功能;使用 WriteStartSheet(string) 與 WriteEndSheet() 的嚴格順序模式時,可支援高效能、低記憶體耗用的寫入作業。
public class OdsStreamWriter : IDisposable, IAsyncDisposable
- Inheritance
-
OdsStreamWriter
- Implements
- Inherited Members
Constructors
OdsStreamWriter(Stream)
Short overload of OdsStreamWriter that accepts outputStream; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 outputStream;其餘可選參數使用預設值並轉呼叫最長 OdsStreamWriter 多載。
public OdsStreamWriter(Stream outputStream)
Parameters
outputStreamStream
OdsStreamWriter(Stream, OdfVersion)
Initializes a new instance of the OdsStreamWriter class. 初始化 OdsStreamWriter 類別的新執行個體。
public OdsStreamWriter(Stream outputStream, OdfVersion version)
Parameters
outputStreamStreamThe target stream used to output the ODS document. / 用來輸出 ODS 文件的目標資料流。
versionOdfVersionThe ODF specification version to write. / 要寫入的 ODF 規格版本。
Exceptions
- ArgumentNullException
Thrown when
outputStreamis null. / 當outputStream為 null 時擲出。
Properties
Version
Gets or sets the ODF version of the ODS document to write. 取得或設定寫入之 ODS 文件的 ODF 版本。
public OdfVersion Version { get; set; }
Property Value
Methods
Dispose()
Closes all underlying streams and releases resources used by OdsStreamWriter. 關閉所有底層資料流並釋放 OdsStreamWriter 使用的資源。
public void Dispose()
Dispose(bool)
Releases unmanaged resources used by the OdsStreamWriter class and optionally releases managed resources. 釋放 OdsStreamWriter 類別所使用的非受控資源,並選擇性釋放受控資源。
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue to release managed and unmanaged resources; false to release only unmanaged resources. / 為 true 則釋放受控與非受控資源;為 false 則僅釋放非受控資源。
DisposeAsync()
Asynchronously releases resources used by the OdsStreamWriter class. 非同步釋放 OdsStreamWriter 類別所使用的資源。
public ValueTask DisposeAsync()
Returns
FlushAsync(CancellationToken)
Asynchronously flushes buffered worksheet XML to the current package entry. 非同步將已緩衝的工作表 XML 沖洗至目前封裝項目。
public Task FlushAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token. / 取消權杖。
Returns
- Task
A task representing the flush operation. / 代表沖洗作業的工作。
Remarks
Package finalization remains synchronous because ZipArchive exposes only synchronous disposal. 封裝最終化仍為同步作業,因為 ZipArchive 僅提供同步處置。
SwitchToSheet(string)
Switches to the specified worksheet and uses temporary buffering to support interleaved multi-sheet writes. 切換至指定工作表,以暫存緩衝支援多工作表交錯寫入。
public void SwitchToSheet(string sheetName)
Parameters
sheetNamestringThe worksheet name to switch to or create. / 要切換或建立的工作表名稱。
Remarks
This method is the buffered convenience path: every switched sheet keeps a temporary XML fragment and is emitted in first-seen order when the writer is disposed. To preserve strict low-memory streaming semantics, use WriteStartSheet(string) and WriteEndSheet() to complete each sheet sequentially. 此方法是緩衝便利路徑:每張曾切換的工作表都會保留一段暫存 XML, 並於釋放寫入器時依首次出現順序輸出。若要維持嚴格低記憶體串流語意,請使用 WriteStartSheet(string) 與 WriteEndSheet() 依序完成每張工作表。
Exceptions
- ArgumentException
Thrown when
sheetNameis null or whitespace, or contains a character that is not valid in XML 1.0. / 當sheetName為 null、空白,或含有 XML 1.0 不允許的字元時擲出。
ToAsyncEnumerable(Action<OdsStreamWriter>)
Converts an ODS write operation to an asynchronous stream of read-only memory byte chunks for chunked HTTP transfer. 將 ODS 文件寫入作業轉換為非同步的唯讀記憶體位元組資料流,可用於 Chunked HTTP 傳輸。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Action<OdsStreamWriter> writeAction)
Parameters
writeActionAction<OdsStreamWriter>
Returns
- IAsyncEnumerable<ReadOnlyMemory<byte>>
An asynchronous enumerator of read-only memory byte chunks. / 非同步唯讀記憶體位元組區段的列舉器。
ToAsyncEnumerable(Action<OdsStreamWriter>, OdfVersion)
Short overload of ToAsyncEnumerable that accepts writeAction and version; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 writeAction 與 version;其餘可選參數使用預設值並轉呼叫最長 ToAsyncEnumerable 多載。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Action<OdsStreamWriter> writeAction, OdfVersion version)
Parameters
writeActionAction<OdsStreamWriter>versionOdfVersion
Returns
ToAsyncEnumerable(Action<OdsStreamWriter>, OdfVersion, CancellationToken)
Short overload of ToAsyncEnumerable that accepts writeAction, version, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 writeAction、version 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 ToAsyncEnumerable 多載。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Action<OdsStreamWriter> writeAction, OdfVersion version, CancellationToken cancellationToken)
Parameters
writeActionAction<OdsStreamWriter>versionOdfVersioncancellationTokenCancellationToken
Returns
ToAsyncEnumerable(Action<OdsStreamWriter>, CancellationToken)
Converts a synchronous ODS write action to chunked HTTP-friendly memory segments with cancellation. 以取消語彙基元將同步 ODS 寫入動作轉換為適合 Chunked HTTP 的記憶體區段。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Action<OdsStreamWriter> writeAction, CancellationToken cancellationToken)
Parameters
writeActionAction<OdsStreamWriter>The synchronous write callback. / 同步寫入回呼。
cancellationTokenCancellationTokenThe cancellation token. / 取消語彙基元。
Returns
- IAsyncEnumerable<ReadOnlyMemory<byte>>
An asynchronous enumerator of read-only memory byte chunks. / 非同步唯讀記憶體位元組區段的列舉器。
ToAsyncEnumerable(Func<OdsStreamWriter, Task>)
Converts an ODS write operation to an asynchronous stream of read-only memory byte chunks for chunked HTTP transfer. 將 ODS 文件寫入作業轉換為非同步的唯讀記憶體位元組資料流,可用於 Chunked HTTP 傳輸。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Func<OdsStreamWriter, Task> writeAction)
Parameters
writeActionFunc<OdsStreamWriter, Task>
Returns
- IAsyncEnumerable<ReadOnlyMemory<byte>>
An asynchronous enumerator of read-only memory byte chunks. / 非同步唯讀記憶體位元組區段的列舉器。
ToAsyncEnumerable(Func<OdsStreamWriter, Task>, OdfVersion)
Short overload of ToAsyncEnumerable that accepts version; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 version;其餘可選參數使用預設值並轉呼叫最長 ToAsyncEnumerable 多載。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Func<OdsStreamWriter, Task> writeAction, OdfVersion version)
Parameters
writeActionFunc<OdsStreamWriter, Task>versionOdfVersion
Returns
ToAsyncEnumerable(Func<OdsStreamWriter, Task>, OdfVersion, CancellationToken)
Short overload of ToAsyncEnumerable that accepts version and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 version 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 ToAsyncEnumerable 多載。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Func<OdsStreamWriter, Task> writeAction, OdfVersion version, CancellationToken cancellationToken)
Parameters
writeActionFunc<OdsStreamWriter, Task>versionOdfVersioncancellationTokenCancellationToken
Returns
ToAsyncEnumerable(Func<OdsStreamWriter, Task>, CancellationToken)
Converts an asynchronous ODS write action to chunked HTTP-friendly memory segments with cancellation. 以取消語彙基元將非同步 ODS 寫入動作轉換為適合 Chunked HTTP 的記憶體區段。
public static IAsyncEnumerable<ReadOnlyMemory<byte>> ToAsyncEnumerable(Func<OdsStreamWriter, Task> writeAction, CancellationToken cancellationToken)
Parameters
writeActionFunc<OdsStreamWriter, Task>The asynchronous write callback. / 非同步寫入回呼。
cancellationTokenCancellationTokenThe cancellation token. / 取消語彙基元。
Returns
- IAsyncEnumerable<ReadOnlyMemory<byte>>
An asynchronous enumerator of read-only memory byte chunks. / 非同步唯讀記憶體位元組區段的列舉器。
WriteCell(bool)
Writes a Boolean cell. 寫入布林值型態的儲存格。
public void WriteCell(bool value)
Parameters
valuebool
Exceptions
- ArgumentException
Thrown when contains a character that is not valid in XML 1.0. / 當 含有 XML 1.0 不允許的字元時擲出。
WriteCell(bool, string?)
Short overload of WriteCell that accepts value and styleName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 value 與 styleName;其餘可選參數使用預設值並轉呼叫最長 WriteCell 多載。
public void WriteCell(bool value, string? styleName)
Parameters
WriteCell(DateTime)
Writes a date and time cell. 寫入日期時間型態的儲存格。
public void WriteCell(DateTime value)
Parameters
valueDateTime
Exceptions
- ArgumentException
Thrown when contains a character that is not valid in XML 1.0. / 當 含有 XML 1.0 不允許的字元時擲出。
WriteCell(DateTime, bool)
Writes a date-time cell with an explicit timezone-naive flag. 寫入日期時間儲存格,並明確指定是否為無時區值。
public void WriteCell(DateTime value, bool timezoneNaive)
Parameters
valueDateTimeThe date-time value. / 日期時間值。
timezoneNaiveboolWhether to emit a timezone-naive value. / 是否輸出無時區值。
WriteCell(DateTime, string?)
Writes a date-time cell with an optional style name. 寫入日期時間儲存格,並可指定樣式名稱。
public void WriteCell(DateTime value, string? styleName)
Parameters
WriteCell(DateTime, string?, bool)
Writes a date-time cell with style name and timezone-naive flag. 寫入日期時間儲存格,並指定樣式名稱與無時區旗標。
public void WriteCell(DateTime value, string? styleName, bool timezoneNaive)
Parameters
valueDateTimeThe date-time value. / 日期時間值。
styleNamestringThe optional style name. / 選用的樣式名稱。
timezoneNaiveboolWhether to emit a timezone-naive value. / 是否輸出無時區值。
WriteCell(double)
Writes a numeric cell. 寫入數值型態的儲存格。
public void WriteCell(double value)
Parameters
valuedouble
Exceptions
- ArgumentException
Thrown when contains a character that is not valid in XML 1.0. / 當 含有 XML 1.0 不允許的字元時擲出。
WriteCell(double, string?)
Short overload of WriteCell that accepts value and styleName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 value 與 styleName;其餘可選參數使用預設值並轉呼叫最長 WriteCell 多載。
public void WriteCell(double value, string? styleName)
Parameters
WriteCell(ReadOnlyMemory<char>)
Writes a string cell. 寫入字串型態的儲存格。
public void WriteCell(ReadOnlyMemory<char> value)
Parameters
valueReadOnlyMemory<char>
Exceptions
- ArgumentException
Thrown when
valueor contains a character that is not valid in XML 1.0. / 當value或 含有 XML 1.0 不允許的字元時擲出。
WriteCell(ReadOnlyMemory<char>, string?)
Short overload of WriteCell that accepts value and styleName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 value 與 styleName;其餘可選參數使用預設值並轉呼叫最長 WriteCell 多載。
public void WriteCell(ReadOnlyMemory<char> value, string? styleName)
Parameters
valueReadOnlyMemory<char>styleNamestring
WriteCell(ReadOnlySpan<char>)
Writes a string cell. 寫入字串型態的儲存格。
public void WriteCell(ReadOnlySpan<char> value)
Parameters
valueReadOnlySpan<char>
Exceptions
- ArgumentException
Thrown when
valueor contains a character that is not valid in XML 1.0. / 當value或 含有 XML 1.0 不允許的字元時擲出。
WriteCell(ReadOnlySpan<char>, string?)
Short overload of WriteCell that accepts value and styleName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 value 與 styleName;其餘可選參數使用預設值並轉呼叫最長 WriteCell 多載。
public void WriteCell(ReadOnlySpan<char> value, string? styleName)
Parameters
valueReadOnlySpan<char>styleNamestring
WriteCell(string)
Writes a string cell. 寫入字串型態的儲存格。
public void WriteCell(string value)
Parameters
valuestring
Exceptions
- ArgumentException
Thrown when
valueor contains a character that is not valid in XML 1.0. / 當value或 含有 XML 1.0 不允許的字元時擲出。
WriteCell(string, string?)
Short overload of WriteCell that accepts value and styleName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 value 與 styleName;其餘可選參數使用預設值並轉呼叫最長 WriteCell 多載。
public void WriteCell(string value, string? styleName)
Parameters
WriteColumn(OdfLength)
Short overload of WriteColumn that accepts width; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 width;其餘可選參數使用預設值並轉呼叫最長 WriteColumn 多載。
public void WriteColumn(OdfLength width)
Parameters
widthOdfLength
WriteColumn(OdfLength, string?)
Writes a column definition. 寫入資料欄定義。
public void WriteColumn(OdfLength width, string? styleName)
Parameters
widthOdfLengthThe column width. / 資料欄寬度。
styleNamestringThe style name; if null, one is generated automatically. / 樣式名稱,如果為 null 則自動產生。
Exceptions
- ArgumentException
Thrown when
styleNamecontains a character that is not valid in XML 1.0. / 當styleName含有 XML 1.0 不允許的字元時擲出。
WriteCsvStreamAsync(Stream)
Writes a CSV stream to the current worksheet row by row with low memory usage. 將 CSV 資料流以低記憶體方式逐列寫入目前工作表。
public Task WriteCsvStreamAsync(Stream csvStream)
Parameters
csvStreamStream
Returns
- Task
A task that represents the asynchronous write operation. / 代表非同步寫入作業的工作。
Exceptions
- ArgumentNullException
- InvalidOperationException
Thrown when no worksheet has been started. / 當目前尚未開始任何工作表時擲出。
WriteCsvStreamAsync(Stream, bool)
Short overload of WriteCsvStreamAsync that accepts csvStream and firstRowAsHeader; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 csvStream 與 firstRowAsHeader;其餘可選參數使用預設值並轉呼叫最長 WriteCsvStreamAsync 多載。
public Task WriteCsvStreamAsync(Stream csvStream, bool firstRowAsHeader)
Parameters
Returns
WriteCsvStreamAsync(Stream, bool, CancellationToken)
Short overload of WriteCsvStreamAsync that accepts csvStream, firstRowAsHeader, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 csvStream、firstRowAsHeader 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 WriteCsvStreamAsync 多載。
public Task WriteCsvStreamAsync(Stream csvStream, bool firstRowAsHeader, CancellationToken cancellationToken)
Parameters
csvStreamStreamfirstRowAsHeaderboolcancellationTokenCancellationToken
Returns
WriteDataAsync(DbDataReader)
Writes the current result set from a DbDataReader to the current worksheet row by row with low memory usage. 將 DbDataReader 目前結果集以低記憶體方式逐列寫入目前工作表。
public Task WriteDataAsync(DbDataReader reader)
Parameters
readerDbDataReader
Returns
- Task
A task that represents the asynchronous write operation. / 代表非同步寫入作業的工作。
Exceptions
- ArgumentNullException
- ObjectDisposedException
Thrown when the writer has been disposed. / 當寫入器已釋放時擲出。
- InvalidOperationException
Thrown when no worksheet has been started. / 當目前尚未開始任何工作表時擲出。
WriteDataAsync(DbDataReader, bool)
Short overload of WriteDataAsync that accepts reader and includeColumnNames; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 reader 與 includeColumnNames;其餘可選參數使用預設值並轉呼叫最長 WriteDataAsync 多載。
public Task WriteDataAsync(DbDataReader reader, bool includeColumnNames)
Parameters
readerDbDataReaderincludeColumnNamesbool
Returns
WriteDataAsync(DbDataReader, bool, CancellationToken)
Short overload of WriteDataAsync that accepts reader, includeColumnNames, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 reader、includeColumnNames 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 WriteDataAsync 多載。
public Task WriteDataAsync(DbDataReader reader, bool includeColumnNames, CancellationToken cancellationToken)
Parameters
readerDbDataReaderincludeColumnNamesboolcancellationTokenCancellationToken
Returns
WriteDataAsync<T>(IAsyncEnumerable<T>)
Writes an asynchronous object sequence to the current worksheet row by row with low memory usage, mapping each readable public instance property of T to a column via ObjectDataReader<T>. Pass an Entity Framework Core query's AsAsyncEnumerable() result here to stream rows from the database directly into the worksheet.
以低記憶體方式將非同步物件序列逐列寫入目前工作表,透過 ObjectDataReader<T> 把 T 的每個可讀公開執行個體屬性對應到一個資料行。可傳入 Entity Framework Core 查詢的 AsAsyncEnumerable() 結果,將資料庫查詢結果直接串流寫入工作表。
public Task WriteDataAsync<T>(IAsyncEnumerable<T> source)
Parameters
sourceIAsyncEnumerable<T>
Returns
- Task
A task that represents the asynchronous write operation. / 代表非同步寫入作業的工作。
Type Parameters
TThe element type whose readable public instance properties become worksheet columns. / 元素型別,其可讀公開執行個體屬性將成為工作表資料行。
Exceptions
WriteDataAsync<T>(IAsyncEnumerable<T>, bool)
Short overload of WriteDataAsync that accepts source and includeColumnNames; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 source 與 includeColumnNames;其餘可選參數使用預設值並轉呼叫最長 WriteDataAsync 多載。
public Task WriteDataAsync<T>(IAsyncEnumerable<T> source, bool includeColumnNames)
Parameters
sourceIAsyncEnumerable<T>includeColumnNamesbool
Returns
Type Parameters
T
WriteDataAsync<T>(IAsyncEnumerable<T>, bool, CancellationToken)
Full overload of WriteDataAsync that accepts source, includeColumnNames, and cancellationToken. WriteDataAsync 完整多載:接受 source、includeColumnNames 與 cancellationToken。
public Task WriteDataAsync<T>(IAsyncEnumerable<T> source, bool includeColumnNames, CancellationToken cancellationToken)
Parameters
sourceIAsyncEnumerable<T>includeColumnNamesboolcancellationTokenCancellationToken
Returns
Type Parameters
T
WriteDataAsync<T>(IEnumerable<T>)
Writes an arbitrary object sequence to the current worksheet row by row with low memory usage, mapping each readable public instance property of T to a column via ObjectDataReader<T>. This lets query projections (for example an Entity Framework Core IQueryable<T> after .Select(...)) be exported without materializing the whole sequence in memory.
以低記憶體方式將任意物件序列逐列寫入目前工作表,透過 ObjectDataReader<T> 把 T 的每個可讀公開執行個體屬性對應到一個資料行。這讓查詢投影(例如 Entity Framework Core IQueryable<T> 經 .Select(...) 後的結果)可以匯出而不必先整個載入記憶體。
public Task WriteDataAsync<T>(IEnumerable<T> source)
Parameters
sourceIEnumerable<T>
Returns
- Task
A task that represents the asynchronous write operation. / 代表非同步寫入作業的工作。
Type Parameters
TThe element type whose readable public instance properties become worksheet columns. / 元素型別,其可讀公開執行個體屬性將成為工作表資料行。
Exceptions
WriteDataAsync<T>(IEnumerable<T>, bool)
Short overload of WriteDataAsync that accepts source and includeColumnNames; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 source 與 includeColumnNames;其餘可選參數使用預設值並轉呼叫最長 WriteDataAsync 多載。
public Task WriteDataAsync<T>(IEnumerable<T> source, bool includeColumnNames)
Parameters
sourceIEnumerable<T>includeColumnNamesbool
Returns
Type Parameters
T
WriteDataAsync<T>(IEnumerable<T>, bool, CancellationToken)
Full overload of WriteDataAsync that accepts source, includeColumnNames, and cancellationToken. WriteDataAsync 完整多載:接受 source、includeColumnNames 與 cancellationToken。
public Task WriteDataAsync<T>(IEnumerable<T> source, bool includeColumnNames, CancellationToken cancellationToken)
Parameters
sourceIEnumerable<T>includeColumnNamesboolcancellationTokenCancellationToken
Returns
Type Parameters
T
WriteEndRow()
Ends writing the current data row. 結束目前資料列的寫入。
public void WriteEndRow()
WriteEndSheet()
Ends writing the current worksheet. 結束目前工作表的寫入。
public void WriteEndSheet()
WriteNode(OdfNode)
Writes an existing DOM subtree directly to the current worksheet or row position. 將既有 DOM 子樹直接寫入目前工作表或資料列位置。
public void WriteNode(OdfNode node)
Parameters
nodeOdfNodeThe DOM node to write. / 要寫入的 DOM 節點。
Exceptions
- ArgumentNullException
- ArgumentException
Thrown when the subtree contains text or attribute values with characters that are not valid in XML 1.0. / 當子樹的文字或屬性值含有 XML 1.0 不允許的字元時擲出。
WriteSheetsAsync(IEnumerable<OdsSheetWriteJob>)
Short overload of WriteSheetsAsync that accepts jobs; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 jobs;其餘可選參數使用預設值並轉呼叫最長 WriteSheetsAsync 多載。
public Task WriteSheetsAsync(IEnumerable<OdsSheetWriteJob> jobs)
Parameters
jobsIEnumerable<OdsSheetWriteJob>
Returns
WriteSheetsAsync(IEnumerable<OdsSheetWriteJob>, int)
Short overload of WriteSheetsAsync that accepts jobs and maxConcurrency; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 jobs 與 maxConcurrency;其餘可選參數使用預設值並轉呼叫最長 WriteSheetsAsync 多載。
public Task WriteSheetsAsync(IEnumerable<OdsSheetWriteJob> jobs, int maxConcurrency)
Parameters
jobsIEnumerable<OdsSheetWriteJob>maxConcurrencyint
Returns
WriteSheetsAsync(IEnumerable<OdsSheetWriteJob>, int, CancellationToken)
Generates XML fragments for multiple worksheets in parallel and writes them to the current ODS package in job list order. 並行產生多個工作表的 XML 片段,並依工作清單順序寫入目前 ODS 封裝。
public Task WriteSheetsAsync(IEnumerable<OdsSheetWriteJob> jobs, int maxConcurrency, CancellationToken cancellationToken)
Parameters
jobsIEnumerable<OdsSheetWriteJob>The worksheet write job list. / 工作表寫入工作清單。
maxConcurrencyintThe maximum concurrency; values less than 1 use the processor count. / 最大並行度;小於 1 時使用處理器核心數。
cancellationTokenCancellationTokenThe cancellation token. / 取消權杖。
Returns
- Task
A task that represents the asynchronous write operation. / 代表非同步寫入作業的工作。
Exceptions
- ArgumentNullException
- ObjectDisposedException
Thrown when the writer has been disposed. / 當寫入器已釋放時擲出。
WriteStartRow()
Starts a table row with default options. 以預設選項開始資料列。
public void WriteStartRow()
WriteStartRow(OdsRowWriteOptions)
Starts a table row using an options object. 以 options 物件開始資料列。
public void WriteStartRow(OdsRowWriteOptions options)
Parameters
optionsOdsRowWriteOptionsThe row write options. / 資料列寫入選項。
WriteStartSheet(string)
Starts writing a new worksheet. 開始寫入一個新的工作表。
public void WriteStartSheet(string sheetName)
Parameters
sheetNamestringThe sheet name. / 工作表名稱。
Remarks
This method writes directly to the current output stream and is suitable for strictly sequential, low-memory sheet output. For interleaved writes across multiple sheets, use SwitchToSheet(string); that mode buffers each sheet fragment for convenience, but memory use grows with buffered content. 此方法會直接寫入目前輸出資料流,適合嚴格順序、低記憶體的工作表輸出。 若需要在多張工作表之間交錯寫入,請使用 SwitchToSheet(string); 該模式會暫存各工作表片段,便利性較高但記憶體用量會隨已緩衝內容增加。
Exceptions
- ArgumentException
Thrown when
sheetNamecontains a character that is not valid in XML 1.0. / 當sheetName含有 XML 1.0 不允許的字元時擲出。