Skip to content

Instantly share code, notes, and snippets.

@sween
Created April 4, 2010 23:54
Show Gist options
  • Select an option

  • Save sween/355822 to your computer and use it in GitHub Desktop.

Select an option

Save sween/355822 to your computer and use it in GitHub Desktop.
[WebMethod]
public string ConvertRTFtoText(String base64rtf)
{
// Crazy Winform in a Web Service
String plainText = "";
String base64rtfs = "";
try
{
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();
byte[] base64array = System.Convert.FromBase64String(base64rtf);
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
string decoded = enc.GetString(base64array);
rtBox.Rtf = decoded;
plainText = rtBox.Text;
}
catch (Exception e)
{
return base64rtfs;
}
return plainText;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment