Introduction


If you are looking for a component .NET to convert RTF to text, then you're on target! «RTF to HTML .Net» helps you extract text from any RTF document.

To illustrate how to easily extract text from RTF, let's look at simple code in C#:

SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
string rtfFile = @"f:\A God-forsaken Hole.rtf";

r.OutputFormat = RtfToHtml.eOutputFormat.Text;
string textData = r.ConvertFileToString(rtfFile);

You will be able extract a text from any type of RTF document. The library extracts good-looking text without unwanted spaces between the letters in words and supports Unicode symbols.

Furthermore, a text layout looks the same as in the RTF with proper line breaks and columns.

Download


To see this functionality firsthand, download the freshest «RTF to HTML .Net» with code examples, 49.2 Mb.

Some examples to convert RTF to Text in C# and VB.NET

1. Convert RTF file to Text file in C#:

SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
string rtfFile = @"d:\The Master and Margarita.rtf";
string textFile = Path.ChangeExtension(rtfFile, ".txt");

r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.Text;
if (r.ConvertFile(rtfFile, textFile)==0)
{
    // Open textFile in the default text editor.
    System.Diagnostics.Process.Start(textFile);
}

2. Convert RTF file to Text file in VB.Net:

Dim r As New SautinSoft.RtfToHtml()
Dim rtfFile As String = "d:\The Master and Margarita.rtf"
Dim textFile As String = Path.ChangeExtension(rtfFile, ".txt")

r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.Text

Dim i As Integer = r.ConvertFile(rtfFile, textFile)
If i = 0 Then
    ' Open textFile in the default text editor.
    System.Diagnostics.Process.Start(textFile)
End If

Technical information and requirements


Requires only .NET Framework 4.0 and up or .NET Core 2.0 and up. Our product is compatible with all languages .NET and supports all Operating Systems where .NET Framework and .NET Core can be used.

Note, that «HTML to RTF .Net» is entirely written in managed C#, which makes it absolutely standalone and an independent library.

.NET Framework, .NET Core
  • .NET Framework 4.0, 4.5, 4.6.1 and higher.
  • .NET Standard 2.0
  • .NET Core and .NET 5.0

Multi-platform component, runs on:

  • Windows
  • Linux
  • Mac OS
WindowsLinuxMac OS

Our component has proven itself on cloud platforms and services:

SharePoint Google Cloud AWS Microsoft Azure Docker
  • SharePoint
  • Google Cloud Platform
  • Amazon Web Services (AWS)
  • Microsoft Azure
  • Docker etc.