获取的纯文本从RTF文本 [英] Get plain text from an RTF text

查看:133
本文介绍了获取的纯文本从RTF文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的数据库中保存的文本以RTF格式列。

I have on my database a column that holds text in RTF format.

如何得到它只是纯文本,使用C#?

How can I get only the plain text of it, using C#?

感谢:D

推荐答案

Microsoft提供一个例子他们基本上坚持了RTF文本在的RichTextBox 然后读。文属性......感觉有点缺憾,但它的作品。

Microsoft provides an example where they basically stick the rtf text in a RichTextBox and then read the .Text property... it feels somewhat kludgy, but it works.

static public string ConvertToText(string rtf)
{
   using(RichTextBox rtb = new RichTextBox())
   {
       rtb.Rtf = rtf;
       return rtb.Text;
   }
}

这篇关于获取的纯文本从RTF文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆