Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeDocumentReader

OfficeIMO.Reader

Namespace
OfficeIMO.Reader
Assembly
OfficeIMO.Reader.Core
Source revision
51cd59ece1fa with working tree changes
Modifiers
sealed

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.

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 required
options OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public 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 required
Exception thrown by a read.
path string? = null optional
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 optional
Options used for the failed read, for its ReaderOptions.OpenPassword and detection limits.

Returns

string
ConvertToMarkdown 3 overloads
public string ConvertToMarkdown(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #

Converts a supported file to its portable Markdown representation.

Parameters

path string required
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

string The emitted Markdown, or an empty string when the reader produced no Markdown.
ConvertToMarkdownAsync 3 overloads
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 required
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task<string> The emitted Markdown, or an empty string when the reader produced no Markdown.
Detect 3 overloads
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 required
options OfficeIMO.Reader.ReaderDetectionOptions? = null optional
public 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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderDetectionOptions? = null optional
public 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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderDetectionOptions? = null optional
DetectAsync 3 overloads
public 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 required
options OfficeIMO.Reader.ReaderDetectionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderDetectionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderDetectionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public ReaderInputKind DetectKind(string path) #

Detects a reader input kind using this reader's handler configuration.

Parameters

path string required
Enumerate 3 overloads
public 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 required
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

IEnumerable<ReaderChunk>
EnumerateAsync 3 overloads
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 required
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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> required
folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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.

public string GetCapabilityManifestJson(bool indented = false) #

Gets the capability manifest for this reader as JSON.

Parameters

indented bool = false optional

Returns

string
public 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 required
cancellationToken System.Threading.CancellationToken = default optional
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 required
cancellationToken System.Threading.CancellationToken = default optional
ReadDocument 3 overloads
public OfficeDocumentReadResult ReadDocument(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #

Reads a file into the shared rich document envelope.

Parameters

path string required
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public 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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public OfficeDocumentReadResult ReadDocument(byte[] bytes, string? sourceName = null, ReaderOptions? options = null, CancellationToken cancellationToken = default) #

Reads bytes into the shared rich document envelope.

Parameters

bytes byte[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
ReadDocumentAsync 3 overloads
public Task<OfficeDocumentReadResult> ReadDocumentAsync(string path, ReaderOptions? options = null, CancellationToken cancellationToken = default) #

Asynchronously reads a file into the shared rich document envelope.

Parameters

path string required
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
ReadDocumentJson 3 overloads
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 required
options OfficeIMO.Reader.ReaderOptions? = null optional
indented bool = false optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

string
public 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 required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
indented bool = false optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

string
public 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[] required
sourceName string? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
indented bool = false optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

string
public 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> required
onCompleted System.Action<OfficeIMO.Reader.ReaderDocumentReadOutcome> required
options OfficeIMO.Reader.ReaderOptions? = null optional
batchOptions OfficeIMO.Reader.ReaderBatchOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task
public 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> required
options OfficeIMO.Reader.ReaderOptions? = null optional
batchOptions OfficeIMO.Reader.ReaderBatchOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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> required
options OfficeIMO.Reader.ReaderOptions? = null optional
batchOptions OfficeIMO.Reader.ReaderBatchOptions? = null optional
onCompleted System.Action<OfficeIMO.Reader.ReaderDocumentReadOutcome>? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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 required
folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
includeChunks bool = true optional
onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null optional
cancellationToken System.Threading.CancellationToken = default optional
ReadHierarchical 3 overloads
public 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 required
readerOptions OfficeIMO.Reader.ReaderOptions? = null optional
chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public 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 required
sourceName string? = null optional
readerOptions OfficeIMO.Reader.ReaderOptions? = null optional
chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public 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[] required
sourceName string? = null optional
readerOptions OfficeIMO.Reader.ReaderOptions? = null optional
chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
ReadHierarchicalAsync 3 overloads
public 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 required
readerOptions OfficeIMO.Reader.ReaderOptions? = null optional
chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
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 required
sourceName string? = null optional
readerOptions OfficeIMO.Reader.ReaderOptions? = null optional
chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
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[] required
sourceName string? = null optional
readerOptions OfficeIMO.Reader.ReaderOptions? = null optional
chunkingOptions OfficeIMO.Reader.ReaderHierarchicalChunkingOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional
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 required
folderOptions OfficeIMO.Reader.ReaderFolderOptions? = null optional
options OfficeIMO.Reader.ReaderOptions? = null optional
includeDocumentChunks bool = true optional
maxReturnedChunks int? = null optional
onProgress System.Action<OfficeIMO.Reader.ReaderProgress>? = null optional
cancellationToken System.Threading.CancellationToken = default optional

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.