How to convert RTF to HTML and vice versa in C#!?

Article from our customer

Our company has a large archive of RTF documents containing various statistics! At the request of our customers and employees around the world, we display these documents in HTML format on the client browser! In addition, users can create/edit HTML documents and store in our archive in the format of RTF by themselves.

For example:
Our database contains a document with information about the number of printers sold by the company officer in January (RTF file). The officer, while in another state, goes to our server through the web-browser requests a file with the number of printers sold in January. RTF file is automatically converted to HTML and displays the employee as an html file with the ability to edit. After making certain changes in the web form, he presses the “save to database.” Edited file is converted back to RTF format and stored in our database under a new name in the directory of the employee! My task was to create an algorithm to convert RTF to HTML and HTML to RTF. The package with .Net components: RTF-to-HTML .Net & HTML-to-RTF .Net of the company «SautinSoft» made almost all my work. It was very simple, reliable and affordable solution!

Below are some common code that allows you to convert RTF to HTML and HTML to RTF:

            SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
            r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML_5;
            r.ImageStyle.IncludeImageInHtml = true;
            string rtf = "..."; //Get RTF from database
            string html = r.ConvertString(rtf);
            //make any manipulations with HTML here
	    SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
	    //Convert to RTF back
            rtf = h.ConvertString(html);

If you need a new code example or have a question: email us at or ask at Online Chat (right-bottom corner of this page) or use the Form below:

Questions and suggestions from you are always welcome!

We are developing .Net components since 2002. We know PDF, DOCX, RTF, HTML, XLSX and Images formats. If you need any assistance with creating, modifying or converting documents in various formats, we can help you. We will write any code example for you absolutely free.