如何将html转换为rtf [英] How to convert an html to rtf

查看:226
本文介绍了如何将html转换为rtf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我需要将页面的html转换为rtf格式,每当用户点击该html页面上的按钮时,它应生成一个rtf该页面的文件。



请告诉我如何在C#中为此创建一个函数...

Hello,

I have an requirement to convert an html of an page to rtf format whenever user click on an button on that html page it should generate an rtf file of that page.

Please tell me how can i create an function for this in an C# for this...

推荐答案

Using reportWebBrowser As New WebBrowser
     reportWebBrowser.CreateControl()
     reportWebBrowser.DocumentText = sbHTMLDoc.ToString
     While reportWebBrowser.DocumentText <> sbHTMLDoc.ToString
         Application.DoEvents()
     End While
     reportWebBrowser.Document.ExecCommand("SelectAll", False, Nothing)
     reportWebBrowser.Document.ExecCommand("Copy", False, Nothing)

     Using reportRichTextBox As New RichTextBox
         reportRichTextBox.Paste()
         reportRichTextBox.SaveFile(DocumentFileName)
     End Using
 End Using





感谢cjbarth on SO



此外,请查看我们的本地文章标记 [ ^ ]



如果这有帮助请花点时间接受解决方案。谢谢。



Thanks to cjbarth on SO

Also, check our local article with excellent marks[^]

If this helps please take time to accept the solution. Thank you.


这篇关于如何将html转换为rtf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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