C # .net converting HTML to RTF

Another post in HTML to RTF Converter for .NET , but are there any open source converters or tutorials? I do not want to use Sautinsoft . I think there is a solution on ExpertExchange, but I have to pay for it. Most google search results point to RTF to html converter, but not to html to RTF converter.

+6
source share
2 answers

At best, an ExpertExchange article is poor. In principle, the OP refused, because they could not give a good answer. They list a link to a CodeProject article ( http://www.codeproject.com/KB/HTML/XHTML2RTF.aspx ) that shows you how to convert HTML to RTF, but it's not really .NET. decision. Instead, it would be something that would have to be very adaptable.

In my experience, there is no good open source converter there. It seems that all the figures are there, but he is waiting for someone to do everything related to this. However, the immediate answer to your question is that there is no longer a converter there.

+3
source

Create a WebBrowser. Download it with the html content. Select all and copy them. Paste into richtextbox. Then you have rtf

string html="...."; // html content RichTextBox rtbTemp= new RichTextBox(); WebBrowser wb = new WebBrowser(); wb.Navigate("about:blank"); wb.Document.Write(html); wb.Document.ExecCommand("SelectAll", false, null); wb.Document.ExecCommand("Copy", false, null); rtbTemp.SelectAll(); rtbTemp.Paste(); 

RtbTemp.RTF now has RTF converted from HTML.

+12
source

Source: https://habr.com/ru/post/887522/


All Articles