Step 1: Download SautinSoft.RtfToHtml.dll DLL from given link
http://downloads.zdnet.com/product/2066-10708032/
Step 2: Add reference to SautinSoft.RtfToHtml.dl to your project.
Step 3: Add namespaces
using SautinSoft;
using System.IO;
Step 4: Write below code on a button click event handler.
- protected void Button1_Click(object sender, EventArgs e)
- {
- SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
- r.OutputFormat = SautinSoft.RtfToHtml.eOutputFormat.HTML_401;
- r.ImageStyle.IncludeImageInHtml = false;
- r.ImageStyle.ImageFolder = Server.MapPath("");
- r.ImageStyle.ImageSubFolder = "images";
- r.ImageStyle.ImageFileName = "picture";
- string rtf = File.ReadAllText(@"C:\Documents\633868836830039716_d50a2ee6-4dad-4911-aaa8-692b24ed8734.rtf");
- string html = r.ConvertString(rtf);
-
- if (html.Length > 0)
- {
- File.WriteAllText(@"C:\myfile.html", html);
- }
- }