Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

RtfReadResult

OfficeIMO.Rtf

Namespace
OfficeIMO.Rtf
Assembly
OfficeIMO.Rtf
Source revision
ba882f6b0d07 with working tree changes
Implements
IOfficeResult<RtfDocument> IOfficeResult
Modifiers
sealed

Result of reading RTF into syntax and semantic models.

Inheritance

  • object
  • RtfReadResult

Usage

Explore 5 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.

Accepted by parameters 1

Methods

public RtfLosslessEditor EditLossless() #

Creates an editor for targeted syntax-preserving changes.

public IReadOnlyList<OfficeEmbeddedPayloadInfo> GetEmbeddedPayloads(OfficeEmbeddedPayloadInspectionOptions options, CancellationToken cancellationToken = default) #

Returns original-source payload descriptors under explicit limits. Optional hashes scan complete payloads within those limits.

Parameters

options OfficeIMO.OfficeEmbeddedPayloadInspectionOptions required
cancellationToken System.Threading.CancellationToken = default optional

Returns

IReadOnlyList<OfficeEmbeddedPayloadInfo>
public OfficeEmbeddedPayloadInspection InspectEmbeddedPayloads(OfficeEmbeddedPayloadInspectionOptions? options = null, CancellationToken cancellationToken = default) #

Inventories inert pict and objdata destinations from the original immutable syntax, including semantically omitted objects. Locations are native RTF group character positions, not physical byte offsets or OPC relationships. Hexadecimal lengths remain unknown without a requested bounded read or hash. Semantic and lossless edits do not replace these original-source session bytes.

Parameters

options OfficeIMO.OfficeEmbeddedPayloadInspectionOptions? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Returns

OfficeEmbeddedPayloadInspection
public Stream OpenEmbeddedPayload(string id, long maximumBytes, CancellationToken cancellationToken = default) #

Reads one complete original-source payload under an explicit decoded byte ceiling without activating an object.

Parameters

id string required
maximumBytes long required
cancellationToken System.Threading.CancellationToken = default optional

Returns

Stream
public RtfDocument RequireValue() #

Returns the produced value or throws when the operation did not complete.

SaveLossless 2 overloads
public void SaveLossless(string path) #

Saves the original RTF stream to a file without semantic normalization.

Parameters

path string required
public void SaveLossless(Stream stream) #

Saves the original RTF stream to a stream without semantic normalization.

Parameters

stream System.IO.Stream required
SaveLosslessAsync 2 overloads
public Task SaveLosslessAsync(string path, CancellationToken cancellationToken = default) #

Saves the original RTF stream to a file without semantic normalization.

Parameters

path string required
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task
public Task SaveLosslessAsync(Stream stream, CancellationToken cancellationToken = default) #

Saves the original RTF stream to a stream without semantic normalization.

Parameters

stream System.IO.Stream required
cancellationToken System.Threading.CancellationToken = default optional

Returns

Task
public byte[] ToBytesLossless() #

Serializes the original syntax tree to source-preserving bytes without semantic normalization.

Returns

byte[]
public string ToRtfLossless() #

Serializes the original syntax tree without semantic normalization.

Returns

string
public bool TryGetLosslessBytes(out byte[] bytes) #

Attempts to return source-preserving bytes without throwing for character-only input.

Parameters

bytes byte[] required

Returns

bool

Properties

public RtfDocument Document { get; } #

Semantic document model.

public RtfDocument Value { get; } #

Gets the produced value, or null when the operation did not complete.

public bool Succeeded { get; } #

Gets whether the operation completed successfully.

public RtfSyntaxTree SyntaxTree { get; } #

Loss-preserving syntax tree.

public IReadOnlyList<RtfDiagnostic> Diagnostics { get; } #

Combined parser and binder diagnostics.

public bool HasOriginalBytes { get; } #

Gets whether the read API retained the exact original source bytes.

public bool CanWriteLosslessBytes { get; } #

Gets whether RtfReadResult.ToBytesLossless can return bytes without character transcoding.