Open and read, create and write RTF in C# and VB.NET with the GemBox.Document component.

GemBox.Document is a C# / VB.NET component that enables developers to read, write, convert, and print document files (DOCX, DOC, PDF, HTML, XPS, RTF, and TXT) from .NET applications in a simple and efficient way without the need for Microsoft Word on either the developer or client machines.
GemBox.Document Free is free of charge, while GemBox.Document Professional is a commercial version that is licensed per developer.
For more information, see GemBox.Document Features or try our examples.

Following example creates and writes a RTF file and then opens and reads it.

C# code

// Create a new empty document.
var document = new DocumentModel();

// Add document content.
document.Sections.Add(
        new Section(document,
        new Paragraph(document, "Hello world!")));

// Save the document to a file.
document.Save("Document.rtf");

// Load a document.
document = DocumentModel.Load("Document.rtf");

// Write document content to Console.
Console.WriteLine(
        document.Sections[0].
        Blocks.Cast<Paragraph>(0).
            Inlines.Cast<Run>(0).Text);

VB.NET code

' Create a new empty document.
Dim document = New DocumentModel()

' Add document content.
document.Sections.Add(
        New Section(document,
        New Paragraph(document, "Hello world!")))

' Save the document to a file.
document.Save("Document.rtf")

' Load a document.
document = DocumentModel.Load("Document.rtf")

' Write document content to Console.
Console.WriteLine(
        document.Sections(0).
        Blocks.Cast(Of Paragraph)(0).
            Inlines.Cast(Of Run)(0).Text)

Download the Free Version of GemBox.Document

GemBox.Document Free delivers the same performance and set of features as the Professional version. However, the Free version is limited to 20 paragraphs. You can use the free version for any purpose, including commercial applications.
If you want to see how fast and efficient GemBox.Document performs for large files, you can enable Trial mode right from within the free version.

Get the GemBox.Document Professional for unlimited use

GemBox.Document is a standalone .NET component for fast reading, writing, editing, converting and printing of DOCX, DOC, PDF, HTML, XPS, RTF, and TXT files using C# or VB.NET with one simple API.