Table of Contents

Class RtfReader

Namespace
DocWright.Formats.Rtf
Assembly
DocWright.Formats.Rtf.dll

Reads Rich Text Format (RTF 1.9) into the mutable DocWright document model.

public sealed class RtfReader : IDocumentReader
Inheritance
RtfReader
Implements
Inherited Members

Remarks

The reader is tolerant by design. RTF is thirty years old, has been written by every word processor and export pipeline ever shipped, and the resulting files disagree with the specification constantly — unbalanced braces, control words that predate or postdate the spec, code page declarations that lie. All of it parses to something predictable, and anything that cannot be represented in a Word document is reported through IConversionDiagnostics rather than dropped in silence.

No network or file-system access happens on a document's behalf. An embedded object that names an external file is reported and skipped; a document-driven fetch would be an SSRF surface.

Instances are stateless and safe for concurrent use; one read allocates one parse.

Constructors

RtfReader()

Initializes a reader with default options.

RtfReader(RtfReadOptions)

Initializes a reader with format-specific options.

Properties

Format

Gets the format this reader handles.

Methods

CanRead(Stream)

Sniffs whether a stream looks like RTF, restoring its position before returning.

Read(Stream, DocumentReadOptions, IConversionDiagnostics)

Reads a document from the stream.