RTF转换为HTML在.NET转换为、RTF、NET、HTML

2023-09-06 05:09:03 作者:独揽帅氕

我已经成功用做反向 web浏览器的RichTextBox

I've managed to do the reverse using WebBrowser and RichTextBox.

不过,我将如何转换成RTF格式为HTML?

But how would I convert RTF to HTML?

推荐答案

免责声明:我正在查看这家公司

Disclaimer: I'm working for this company.

我看到的,问题是旧的,但对于这一点,也许有人搜索解决方案。我们的组件RTF到HTML允许RTF格式转换为HTML。您可以下载一个组件或尝试网上演示。第一次尝试试用版本,如果你有一个疑问。 :)审判是免费的。

As I see, the question is old but maybe someone search solution for this too. Our component RTF to HTML allows to convert RTF to HTML. You may download a component or try online-demo. Try the trial version first if you have a doubt. :) Trial is free.

下面是从RTF转换在ASP.NET到HTML中的code样品:

Here's the code sample for the converting from RTF to HTML in ASP.NET:

    SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
    r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML_401;
    r.ImageStyle.IncludeImageInHtml = false; //To save images inside HTML as binary data specify this property to 'true'

    r.ImageStyle.ImageFolder = Server.MapPath(""); 
    r.ImageStyle.ImageSubFolder = "images";
    r.ImageStyle.ImageFileName = "picture";       

    string rtf = ".....";
    string html = r.ConvertString(rtf);        

    //show HTML
    if (html.Length>0)
    {
        Response.Buffer = true;
        Response.Clear();
        Response.ContentType = "text/html";
        Response.Write(html);
        Response.Flush();
        Response.End();
    }