SautinSoft is an Internet-oriented software development company
 

Convert RTF to HTML in C# (C sharp)

RTF-to-HTML DLL .Net
 
Here you will see how to convert RTF to HTML in C# with help of our component!
 
     
 

This is a first sample how to convert RTF file to HTML file in C#, you will need only two lines of code:

SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
r.ConvertFile(@"d:\test.rtf", @"d:\test.html");

 

This sample demonstrates how to convert RTF string to HTML string in C# (C Sharp), it usefull when you don't want to create physical files and work only with memory:

SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
string rtf = @"{\rtf {\b bold text {\i bold + italic}} and plan text}";
string html = r.ConvertString(rtf);

 

The component has a lot of properties, for example when you want to export RTF into HTML with images you may save all images as physical files in a single folder or save images inside HTML document.

C# sample how to force the dll store images in folder 'd:\my webs\images':

P.S. the folder 'd:\my webs' must exist, subfolder 'images' will be created by component.

SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
r.ImageStyle.ImageFolder = @"d:\my webs";
r.ImageStyle.ImageSubFolder = "images";
r.ImageStyle.IncludeImageInHtml = false;		  
r.ConvertFile(@"d:\test.rtf", @"d:\test.html");

 

This is a C# sample how to force the dll store images inside HTML document. It's usefull when you want to make RTF converting in memory without creating any files on HDD. Images will be saved inside HTML using base64 algorithm:

SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
r.ImageStyle.IncludeImageInHtml = true;		  
string html = r.ConvertFileToString(@"d:\test.rtf");

 

 

.Net library which add ability to convert RTF to HTML in C# on fly!
 

 

We've showed some samples in C# (C Sharp) here, but it's only small part of properties and abilities of the SautinSoft.RtfToHtml.dll. The component also can:

  • Convert RTF to XHTML
  • Convert RTF to plain HTML 3.2 and 4.01 with CSS
  • Transform RTF to Text
  • Export Text to HTML

You may also adjust such features using component's properties:

  • Specify image quality, type of image saving
  • Encoding of HTML document
  • Table width and borders
  • Converting only part of document between <body>...</body> tags
  • Auto-detect hyperlinks
  • etc.

Another essential thing in converting of RTF to HTML in C# is a system requirements. Our component requires only .Net 1.1 or higher platform installed. We don't use Internet Explorer or MS Office automation to make component independent and standalone. It's very important thing.

The dll is completely created in C# and works with medium trust level.

Home | Contact | Privacy

Copyright © 2002 - 2010, SautinSoft (started from sautin.com). All rights reserved.