OfficeTableFormat
OfficeIMO.Data
Reads and writes the tables of a multi-table file format, such as a workbook, as data readers. Structured-data conversion takes providers through its options, so a format is available only where its package is referenced.
Inheritance
- object
- OfficeTableFormat
Remarks
Formats are named by their usual file extension without the dot, in lower case: xlsx, xlsb, xls, ods. Input streams passed to a provider can seek, and providers leave every stream open.
Methods
public virtual IReadOnlyList<OfficeDiagnostic>? Convert(Stream input, string source, Stream output, string target, CancellationToken cancellationToken) #Converts a whole file between two formats of this provider, keeping what both formats hold beyond cell values. Returns the findings, or null when this provider does not convert that pair; the conversion then copies cell values table by table.
Parameters
- input System.IO.Stream
- source string
- output System.IO.Stream
- target string
- cancellationToken System.Threading.CancellationToken
Returns
IReadOnlyList<OfficeDiagnostic>?public abstract DbDataReader OpenReader(Stream input, string format, OfficeTableReadRequest request, CancellationToken cancellationToken) #Opens the rows of one table, or of every table as successive results when OfficeTableReadRequest.Table is null.
Parameters
- input System.IO.Stream
- format string
- request OfficeIMO.Data.OfficeTableReadRequest
- cancellationToken System.Threading.CancellationToken
Returns
DbDataReaderpublic abstract IReadOnlyList<string> ReadTableNames(Stream input, string format, CancellationToken cancellationToken) #Gets the names of the tables in input, in order, and leaves its position unchanged.
Parameters
- input System.IO.Stream
- format string
- cancellationToken System.Threading.CancellationToken
Returns
IReadOnlyList<string>public abstract IReadOnlyList<OfficeDiagnostic> Write(Stream output, string format, IEnumerable<OfficeTable> tables, CancellationToken cancellationToken) #Writes each table in turn and returns what the format could not hold.
Parameters
- output System.IO.Stream
- Receives the file.
- format string
- The format to write.
- tables System.Collections.Generic.IEnumerable<OfficeIMO.Data.OfficeTable>
- The tables to write. Each table's rows can be read only until the next table is taken.
- cancellationToken System.Threading.CancellationToken
- Cancels writing.
Returns
IReadOnlyList<OfficeDiagnostic>Inherited Methods
Properties
public abstract IReadOnlyList<string> Formats { get; } #Gets the formats this provider reads and writes.