将RTF格式转换为HTML标记

use*_*347 3 html c# rtf winforms

也许有人可以帮助我解决以下问题.我有一个丰富的文本框控件:RichTxtDescription.我填写的文字如下:

String _description = “Some text with rft tags like \\ine , \b,  \b01 etc.”;
 RichTxtDescription.Rft = @"{\rtf1\ansi " + _Description + "\\line \\line Query: \\line .}";
Run Code Online (Sandbox Code Playgroud)

在我的winform应用程序中,richtextbox控件按原样填充(带有新行,粗体等的文本).现在,我想将richTxtDescription.Rft转换为html标签,以便在rtf字段上显示它只接受html标签.

有什么建议?

谢谢!

Vij*_*ill 9

我昨天使用了这个RTF转换器 :)我很高兴.

  • 下载该项目
  • 编译解决方案"RtfWinForms2010.sln".
  • 在bin文件夹(与解决方案相同的级别)中,您将找到可以使用的DLL.他们的名字以"Itenso"开头.您可能感兴趣的将是"Itenso.Rtf.Converter.Html.dll"以及此DLL所依赖的那些.
  • 添加对项目的引用,并使用以下代码段作为起点.

    IRtfDocument rtfDocument = RtfInterpreterTool.BuildDoc(yourRtfVariable);

    RtfHtmlConverter htmlConverter = new RtfHtmlConverter(rtfDocument);

    string html = htmlConverter.Convert();