How do I convert HTML to RTF (Rich Text) in .NET without paying for a component? [closed]

Actually there is a simple and free solution: use your browser, ok this is the trick I used:

var webBrowser = new WebBrowser();
webBrowser.CreateControl(); // only if needed
webBrowser.DocumentText = *yourhtmlstring*;
while (_webBrowser.DocumentText != *yourhtmlstring*)
    Application.DoEvents();
webBrowser.Document.ExecCommand("SelectAll", false, null);
webBrowser.Document.ExecCommand("Copy", false, null);
*yourRichTextControl*.Paste(); 

This could be slower than other methods but at least it’s free and works!

Leave a Comment