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

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!
By: Yana
 
Oct. 25, 2011 - PRLog -- Hi!
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);

# # #

SautinSoft is the independent software development company. The line of our software applications was started in 2002 (web-site www.sautin.com) and now developing components for converting such formats as: HTML, RTF, PDF, Word and others.
End
Source:Yana
Email:***@sautinsoft.com Email Verified
Zip:427440
Tags:Convert, How To
Industry:Software
Location:Votkinsk - Udmurt Republic - Russian Federation
Account Email Address Verified     Account Phone Number Verified     Disclaimer     Report Abuse
Sautinsoft News
Trending
Most Viewed
Daily News



Like PRLog?
9K2K1K
Click to Share