OfficeDocumentReader
OfficeIMO.Reader
Immutable, instance-scoped OfficeIMO document reader suitable for services and concurrent hosts.
Inheritance
- object
- OfficeDocumentReader
Remarks
Handler routing is frozen when the reader is built. Other OfficeDocumentReader instances cannot change this reader's behavior.
Usage
Explore 2 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 2
- Property OfficeDocumentReader.Default
- Method OfficeDocumentReaderBuilder.Build
Methods
public ReaderChunkHierarchyResult ChunkDocument(OfficeDocumentReadResult document, ReaderHierarchicalChunkingOptions? options = null, CancellationToken cancellationToken = default) #Token-chunks an already-read rich document and builds its hierarchy.
Parameters
- document OfficeIMO.Reader.OfficeDocumentReadResult
- options OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ReaderChunkHierarchyResultpublic string ClassifyReadError(Exception exception, string? path = null, ReaderOptions? options = null) #Maps a read exception to a stable ReaderErrorCodes value using this reader's handlers, the same classification batch outcomes and folder documents report.
Parameters
- exception System.Exception
- Exception thrown by a read.
- path string? = null
- Optional path of the file that failed. Encrypted Office files report a missing or wrong password as a general load failure; with the path, bounded detection of the file refines that to ReaderErrorCodes.PasswordRequired or ReaderErrorCodes.InvalidPassword.
- options OfficeIMO.Reader.ReaderOptions? = null
- Options used for the failed read, for its ReaderOptions.OpenPassword and detection limits.
Returns
stringpublic string ConvertToMarkdown(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Converts a supported file to its portable Markdown representation.
Parameters
- path string
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
string The emitted Markdown, or an empty string when the reader produced no Markdown.public string ConvertToMarkdown(Stream stream, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Converts a supported stream to its portable Markdown representation. The caller retains ownership of the stream.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
string The emitted Markdown, or an empty string when the reader produced no Markdown.public string ConvertToMarkdown(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Converts supported bytes to their portable Markdown representation.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
string The emitted Markdown, or an empty string when the reader produced no Markdown.public async Task<string> ConvertToMarkdownAsync(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously converts a supported file to its portable Markdown representation.
Parameters
- path string
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<string> The emitted Markdown, or an empty string when the reader produced no Markdown.public async Task<string> ConvertToMarkdownAsync(Stream stream, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously converts a supported stream to its portable Markdown representation. The caller retains ownership of the stream.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<string> The emitted Markdown, or an empty string when the reader produced no Markdown.public async Task<string> ConvertToMarkdownAsync(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously converts supported bytes to their portable Markdown representation.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<string> The emitted Markdown, or an empty string when the reader produced no Markdown.public ReaderDetectionResult Detect(string path, ReaderDetectionOptions? options = null) #Detects a file kind from extension and bounded content evidence using this reader's handlers.
Parameters
- path string
- options OfficeIMO.Reader.ReaderDetectionOptions? = null
Returns
ReaderDetectionResultpublic ReaderDetectionResult Detect(Stream stream, string? sourceName = null, ReaderDetectionOptions? options = null) #Detects a stream kind from source-name and bounded content evidence using this reader's handlers.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderDetectionOptions? = null
Returns
ReaderDetectionResultpublic ReaderDetectionResult Detect(byte[] bytes, string? sourceName = null, ReaderDetectionOptions? options = null) #Detects a byte payload kind from source-name and bounded content evidence using this reader's handlers.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderDetectionOptions? = null
Returns
ReaderDetectionResultpublic Task<ReaderDetectionResult> DetectAsync(string path, ReaderDetectionOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously detects a file kind from extension and bounded content evidence using this reader's handlers.
Parameters
- path string
- options OfficeIMO.Reader.ReaderDetectionOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ReaderDetectionResult>public Task<ReaderDetectionResult> DetectAsync(Stream stream, string? sourceName = null, ReaderDetectionOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously detects a stream kind from source-name and bounded content evidence using this reader's handlers.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderDetectionOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ReaderDetectionResult>public Task<ReaderDetectionResult> DetectAsync(byte[] bytes, string? sourceName = null, ReaderDetectionOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously detects a byte payload kind from source-name and bounded content evidence using this reader's handlers.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderDetectionOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ReaderDetectionResult>public ReaderInputKind DetectKind(string path) #Detects a reader input kind using this reader's handler configuration.
Parameters
- path string
Returns
ReaderInputKindpublic IEnumerable<ReaderChunk> Enumerate(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Pulls chunks on demand from incremental handlers, with a materialized fallback for other handlers.
Parameters
- path string
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<ReaderChunk>public IEnumerable<ReaderChunk> Enumerate(Stream stream, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Pulls chunks from a stable caller-owned stream without a full snapshot when the handler supports it.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<ReaderChunk>public IEnumerable<ReaderChunk> Enumerate(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Enumerates chunks from caller-owned bytes.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<ReaderChunk>public IAsyncEnumerable<ReaderChunk> EnumerateAsync(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Pulls chunks asynchronously with backpressure; synchronous handlers execute on a worker.
Parameters
- path string
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IAsyncEnumerable<ReaderChunk>public IAsyncEnumerable<ReaderChunk> EnumerateAsync(Stream stream, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Pulls caller-owned stream chunks asynchronously with backpressure and early-disposal cleanup.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IAsyncEnumerable<ReaderChunk>public IAsyncEnumerable<ReaderChunk> EnumerateAsync(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Enumerates caller-owned bytes asynchronously with backpressure.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IAsyncEnumerable<ReaderChunk>public IEnumerable<string> EnumerateDocumentPaths(IEnumerable<string> paths, ReaderFolderOptions? folderOptions = null, CancellationToken cancellationToken = default) #Expands files and folders using this reader's registered extensions.
Parameters
- paths System.Collections.Generic.IEnumerable<string>
- folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<string>public IEnumerable<ReaderChunk> EnumerateFolder(string folderPath, ReaderFolderOptions? folderOptions = null, ReaderOptions? options = null, Action<ReaderProgress>? onProgress = null, CancellationToken cancellationToken = default) #Enumerates a folder using this reader's registered extensions and handlers.
Parameters
- folderPath string
- folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<ReaderChunk>public IEnumerable<ReaderSourceDocument> EnumerateFolderDocuments(string folderPath, ReaderFolderOptions? folderOptions = null, ReaderOptions? options = null, Action<ReaderProgress>? onProgress = null, CancellationToken cancellationToken = default) #Enumerates a folder as one source-level payload per file.
Parameters
- folderPath string
- folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IEnumerable<ReaderSourceDocument>public IReadOnlyList<ReaderTable> ExtractMarkdownTables(string markdown, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Extracts Markdown tables using the configured reader parsing contract.
Parameters
- markdown string
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ReaderTable>public IReadOnlyList<ReaderHandlerCapability> GetCapabilities() #Gets the capabilities configured for this reader.
Returns
IReadOnlyList<ReaderHandlerCapability>public ReaderCapabilityManifest GetCapabilityManifest() #Gets a machine-readable capability manifest for this reader.
Returns
ReaderCapabilityManifestpublic string GetCapabilityManifestJson(bool indented = false) #Gets the capability manifest for this reader as JSON.
Parameters
- indented bool = false
Returns
stringpublic OfficeDocumentProcessingResult ProcessDocument(OfficeDocumentReadResult document, CancellationToken cancellationToken = default) #Processes an already-read document and nested results through this reader's frozen pipeline.
Parameters
- document OfficeIMO.Reader.OfficeDocumentReadResult
- cancellationToken System.Threading.CancellationToken = default
public async Task<OfficeDocumentProcessingResult> ProcessDocumentAsync(OfficeDocumentReadResult document, CancellationToken cancellationToken = default) #Processes an already-read document and nested results asynchronously through this reader's frozen pipeline.
Parameters
- document OfficeIMO.Reader.OfficeDocumentReadResult
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<OfficeDocumentProcessingResult>public OfficeDocumentReadResult ReadDocument(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Reads a file into the shared rich document envelope.
Parameters
- path string
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
OfficeDocumentReadResultpublic OfficeDocumentReadResult ReadDocument(Stream stream, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Reads a stream into the shared rich document envelope.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
OfficeDocumentReadResultpublic OfficeDocumentReadResult ReadDocument(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Reads bytes into the shared rich document envelope.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
OfficeDocumentReadResultpublic Task<OfficeDocumentReadResult> ReadDocumentAsync(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously reads a file into the shared rich document envelope.
Parameters
- path string
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<OfficeDocumentReadResult>public Task<OfficeDocumentReadResult> ReadDocumentAsync(Stream stream, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously reads a stream into the shared rich document envelope. The caller retains ownership of the stream.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<OfficeDocumentReadResult>public Task<OfficeDocumentReadResult> ReadDocumentAsync(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #Asynchronously reads bytes into the shared rich document envelope.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<OfficeDocumentReadResult>public string ReadDocumentJson(string path, ReaderOptions? options = null, bool indented = false, CancellationToken cancellationToken = default) #Reads a file into the shared rich document JSON envelope.
Parameters
- path string
- options OfficeIMO.Reader.ReaderOptions? = null
- indented bool = false
- cancellationToken System.Threading.CancellationToken = default
Returns
stringpublic string ReadDocumentJson(Stream stream, string? sourceName = null, ReaderOptions? options = null, bool indented = false, CancellationToken cancellationToken = default) #Reads a stream into the shared rich document JSON envelope.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- indented bool = false
- cancellationToken System.Threading.CancellationToken = default
Returns
stringpublic string ReadDocumentJson(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, bool indented = false, CancellationToken cancellationToken = default) #Reads bytes into the shared rich document JSON envelope.
Parameters
- bytes byte[]
- sourceName string? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- indented bool = false
- cancellationToken System.Threading.CancellationToken = default
Returns
stringpublic async Task ReadDocumentsAsCompletedAsync(IEnumerable<string> paths, Action<ReaderDocumentReadOutcome> onCompleted, ReaderOptions? options = null, ReaderBatchOptions? batchOptions = null, CancellationToken cancellationToken = default) #Asynchronously reads a bounded set of files and reports each resilient outcome without retaining completed document results for the lifetime of the whole batch.
Parameters
- paths System.Collections.Generic.IEnumerable<string>
- onCompleted System.Action<OfficeIMO.Reader.ReaderDocumentReadOutcome>
- options OfficeIMO.Reader.ReaderOptions? = null
- batchOptions OfficeIMO.Reader.ReaderBatchOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Taskpublic async Task<IReadOnlyList<OfficeDocumentReadResult>> ReadDocumentsAsync(IEnumerable<string> paths, ReaderOptions? options = null, ReaderBatchOptions? batchOptions = null, CancellationToken cancellationToken = default) #Asynchronously reads a bounded set of files. Results retain the input path order.
Parameters
- paths System.Collections.Generic.IEnumerable<string>
- options OfficeIMO.Reader.ReaderOptions? = null
- batchOptions OfficeIMO.Reader.ReaderBatchOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<IReadOnlyList<OfficeDocumentReadResult>>public async Task<IReadOnlyList<ReaderDocumentReadOutcome>> ReadDocumentsDetailedAsync(IEnumerable<string> paths, ReaderOptions? options = null, ReaderBatchOptions? batchOptions = null, Action<ReaderDocumentReadOutcome>? onCompleted = null, CancellationToken cancellationToken = default) #Asynchronously reads a bounded set of files and captures a success or error outcome for every path.
Parameters
- paths System.Collections.Generic.IEnumerable<string>
- options OfficeIMO.Reader.ReaderOptions? = null
- batchOptions OfficeIMO.Reader.ReaderBatchOptions? = null
- onCompleted System.Action<OfficeIMO.Reader.ReaderDocumentReadOutcome>? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<IReadOnlyList<ReaderDocumentReadOutcome>>public ReaderIngestResult ReadFolderDetailed(string folderPath, ReaderFolderOptions? folderOptions = null, ReaderOptions? options = null, bool includeChunks = true, Action<ReaderProgress>? onProgress = null, CancellationToken cancellationToken = default) #Reads a folder and returns materialized ingestion details.
Parameters
- folderPath string
- folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- includeChunks bool = true
- onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ReaderIngestResultpublic ReaderChunkHierarchyResult ReadHierarchical(string path, ReaderOptions? readerOptions = null, ReaderHierarchicalChunkingOptions? chunkingOptions = null, CancellationToken cancellationToken = default) #Reads a file through configured processors and returns hierarchical chunks.
Parameters
- path string
- readerOptions OfficeIMO.Reader.ReaderOptions? = null
- chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ReaderChunkHierarchyResultpublic ReaderChunkHierarchyResult ReadHierarchical(Stream stream, string? sourceName = null, ReaderOptions? readerOptions = null, ReaderHierarchicalChunkingOptions? chunkingOptions = null, CancellationToken cancellationToken = default) #Reads a stream through configured processors and returns hierarchical chunks.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- readerOptions OfficeIMO.Reader.ReaderOptions? = null
- chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ReaderChunkHierarchyResultpublic ReaderChunkHierarchyResult ReadHierarchical(byte[] bytes, string? sourceName = null, ReaderOptions? readerOptions = null, ReaderHierarchicalChunkingOptions? chunkingOptions = null, CancellationToken cancellationToken = default) #Reads bytes through configured processors and returns hierarchical chunks.
Parameters
- bytes byte[]
- sourceName string? = null
- readerOptions OfficeIMO.Reader.ReaderOptions? = null
- chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ReaderChunkHierarchyResultpublic async Task<ReaderChunkHierarchyResult> ReadHierarchicalAsync(string path, ReaderOptions? readerOptions = null, ReaderHierarchicalChunkingOptions? chunkingOptions = null, CancellationToken cancellationToken = default) #Asynchronously reads a file through configured processors and returns hierarchical chunks.
Parameters
- path string
- readerOptions OfficeIMO.Reader.ReaderOptions? = null
- chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ReaderChunkHierarchyResult>public async Task<ReaderChunkHierarchyResult> ReadHierarchicalAsync(Stream stream, string? sourceName = null, ReaderOptions? readerOptions = null, ReaderHierarchicalChunkingOptions? chunkingOptions = null, CancellationToken cancellationToken = default) #Asynchronously reads a stream through configured processors and returns hierarchical chunks.
Parameters
- stream System.IO.Stream
- sourceName string? = null
- readerOptions OfficeIMO.Reader.ReaderOptions? = null
- chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ReaderChunkHierarchyResult>public async Task<ReaderChunkHierarchyResult> ReadHierarchicalAsync(byte[] bytes, string? sourceName = null, ReaderOptions? readerOptions = null, ReaderHierarchicalChunkingOptions? chunkingOptions = null, CancellationToken cancellationToken = default) #Asynchronously reads bytes through configured processors and returns hierarchical chunks.
Parameters
- bytes byte[]
- sourceName string? = null
- readerOptions OfficeIMO.Reader.ReaderOptions? = null
- chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ReaderChunkHierarchyResult>public ReaderPathDocumentResult ReadPathDocumentsDetailed(string path, ReaderFolderOptions? folderOptions = null, ReaderOptions? options = null, bool includeDocumentChunks = true, int? maxReturnedChunks = null, Action<ReaderProgress>? onProgress = null, CancellationToken cancellationToken = default) #Reads a file or folder and returns source-level document payloads with optional chunk shaping.
Parameters
- path string
- folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null
- options OfficeIMO.Reader.ReaderOptions? = null
- includeDocumentChunks bool = true
- maxReturnedChunks int? = null
- onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ReaderPathDocumentResultInherited Methods
Properties
public static OfficeDocumentReader Default { get; } #Gets an immutable reader with no configured format handlers.
public int MaxConcurrentReads { get; } #Gets the maximum number of asynchronous operations allowed in flight for this reader.
public OfficeDocumentProcessorPipeline ProcessorPipeline { get; } #Gets this reader's immutable ordered processor pipeline.
public OfficeDocumentProcessorFailureBehavior ProcessorFailureBehavior { get; } #Gets the configured processor failure behavior.
public ReaderOptions DefaultOptions { get; } #Returns an independent copy of this reader's default read and folder policies.