![]() |
VOOZH | about |
dotnet add package OfficeIMO.Rtf --version 0.1.1
NuGet\Install-Package OfficeIMO.Rtf -Version 0.1.1
<PackageReference Include="OfficeIMO.Rtf" Version="0.1.1" />
<PackageVersion Include="OfficeIMO.Rtf" Version="0.1.1" />Directory.Packages.props
<PackageReference Include="OfficeIMO.Rtf" />Project file
paket add OfficeIMO.Rtf --version 0.1.1
#r "nuget: OfficeIMO.Rtf, 0.1.1"
#:package OfficeIMO.Rtf@0.1.1
#addin nuget:?package=OfficeIMO.Rtf&version=0.1.1Install as a Cake Addin
#tool nuget:?package=OfficeIMO.Rtf&version=0.1.1Install as a Cake Tool
OfficeIMO.Rtf is a dependency-free Rich Text Format engine for OfficeIMO.
The package owns RTF parsing, syntax-tree preservation, semantic document binding, fluent document construction, and deterministic RTF writing. Adapters such as OfficeIMO.Word.Rtf should reference this package instead of reimplementing RTF parsing or writing.
OfficeIMO.Rtf.Syntax tokenizes and parses RTF groups, control words, control symbols, text, and binary payloads while retaining raw source tokens.OfficeIMO.Rtf.Model exposes a semantic document model for paragraphs, runs, fonts, colors, styles, tables, images, and future document constructs.OfficeIMO.Rtf.Writing serializes the semantic model back to deterministic RTF.RtfDestinationRegistry centralizes destination categories used by readers, editors, and diagnostics.RtfReadResult.ToRtfLossless(), RtfReadResult.SaveLossless(...), and their async counterparts write the parsed syntax tree without semantic normalization, preserving unknown destinations and raw binary payload bytes.using OfficeIMO.Rtf;
RtfDocument document = RtfDocument.Create();
document.AddParagraph()
.AddText("Hello ")
.Bold();
document.Paragraphs[0]
.AddText("RTF");
string rtf = document.ToRtf();
RtfReadResult read = RtfDocument.Read(rtf);
Use the lossless API when the goal is to preserve an existing RTF stream exactly, including destinations that are not yet semantically modeled.
RtfReadResult read = RtfDocument.Load("input.rtf");
read.SaveLossless("output.rtf");
Async file and stream APIs are available for the same boundary:
RtfReadResult read = await RtfDocument.LoadAsync("input.rtf");
await read.SaveLosslessAsync("output.rtf");
The normal RtfDocument.ToRtf() path writes from the semantic model and is intentionally normalized. The lossless path writes from the syntax tree captured during read.
RTF hex escapes such as \'a3 and literal high-byte text loaded through the byte-preserving APIs are decoded according to the active ANSI code page. The reader currently supports dependency-free decoding for single-byte Windows ANSI code pages 874 and 1250 through 1258, with Windows-1252 as the default. Unsupported code pages emit diagnostic RTF103 and fall back to Windows-1252 while the original syntax remains available through the lossless APIs.
Use RtfLosslessEditor for targeted changes that should preserve untouched RTF syntax.
RtfReadResult read = RtfDocument.Load("input.rtf");
RtfLosslessEditor editor = read.EditLossless();
editor.ReplaceText("Old text", "New text");
editor.SetInfo(RtfDocumentInfoField.Title, "Updated title");
editor.SetUserProperty("Client", "Contoso");
editor.SetDocumentVariable("Client", "Contoso");
editor.AppendParagraph("New paragraph");
string editedRtf = editor.ToRtf();
RtfReadResult editedRead = editor.ToReadResult();
The editor rewrites only affected syntax nodes and RTF-escapes inserted text. Text replacement intentionally skips structural destinations such as font tables, stylesheets, metadata, pictures, objects, list tables, ignorable destinations, and field instructions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 4 NuGet packages that depend on OfficeIMO.Rtf:
| Package | Downloads |
|---|---|
|
OfficeIMO.Html
Shared HTML ingestion policies, helpers, and first-party HTML bridge APIs for OfficeIMO converters. |
|
|
OfficeIMO.Word.Rtf
RTF converter for OfficeIMO.Word using the dependency-free OfficeIMO.Rtf engine. |
|
|
OfficeIMO.Rtf.Pdf
Bidirectional semantic RTF/PDF converter for OfficeIMO.Rtf using the dependency-free OfficeIMO.Pdf engine. |
|
|
OfficeIMO.Reader.Rtf
RTF adapter for OfficeIMO.Reader using the dependency-free OfficeIMO.Rtf semantic model. |
This package is not used by any popular GitHub repositories.