Skip to content

Instantly share code, notes, and snippets.

@karoltheguy
Created March 5, 2019 23:29
Show Gist options
  • Select an option

  • Save karoltheguy/9594aad775ffcdda72080a8710266f5a to your computer and use it in GitHub Desktop.

Select an option

Save karoltheguy/9594aad775ffcdda72080a8710266f5a to your computer and use it in GitHub Desktop.
Convert RTF file content to plain text string
string path = @"C:\test\test rich.rtf";
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();
// Get the contents of the RTF file. Note that when it is
// stored in the string, it is encoded as UTF-16.
string s = System.IO.File.ReadAllText(path);
// Convert the RTF to plain text.
rtBox.Rtf = s;
Console.WriteLine(rtBox.Text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment