logo
«RTF to HTML .Net» is a standalone C# component to convert Text, RTF, DOCX documents to HTML, XHTML, HTML5 and RTF to Text
Overview | Getting Started | Code Samples |FAQ | History | License | Order and Pricing |Support and Contacts

FAQ

Here you may find answers on most popular questions regarding «RTF to HTML .Net». See also the Answers about Purchase and Delivery.

First version of RTF-to-HTML DLL .Net released!

CSS

  1. I was wondering if the styles could be moved from tags <style>...</style> to a HTML document?
  2. Can I specify a prefix to style class names in HTML?

Images

  1. After the conversion from RTF to HTML the 'src' property of the '<img>' tag displays binary data. Is there any way to get/save this data separately and provide a relative path?

  2. Why I don't see images in HTML after converting?
  3. How to create HTML email with images in attachment from RTF using your component?

HTML document

  1. How to change document title between tags <title>...</title>?

  2. Is it possible to get only a part of HTML between tags <body>...</body>?

Our answers

CSS

  1. I was wondering if the styles could be moved from tags <style>...</style> to a HTML document?

    Answer: Yes, you may specify the component to save all CSS as inline styles. Inline CSS styles are specified using the "style" attribute. For example:
    <p style="font-face: Arial; color: red">
    Set the property SautinSoft.RtfToHtml.CTextStyle.InlineCSS to true.

    C#:
    SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
    r.TextStyle.InlineCSS = true;		  
    

    VB.Net:
    Dim r As New SautinSoft.RtfToHtml()
    r.TextStyle.InlineCSS = True
  2. Can I specify a prefix to style class names in HTML?

    Answer: Yes, you may specify a template name for styles and start number, for example 'mystyle100'. See detailed code sample ...

Images

  1. After the conversion from RTF to HTML the 'src' property of the '<img>' tag displays binary data. Is there any way to get/save this data separately and provide a relative path?

    Answer: Some browsers, for example IE7 doesn't show images in binary base64 format. This is supported only in IE8 and higher. The best way to see images is save them to HDD. To specify the component to save images as physical files on HDD. Set the property SautinSoft.RtfToHtml.CImageStyle.IncludeImageInHtml to false.

    C#:
    SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
    r.ImageStyle.IncludeImageInHtml = false;
    r.ImageStyle.ImageFolder = @"d:\";
    r.ImageStyle.ImageSubFolder = "";  
    

    VB.Net:
    Dim r As New SautinSoft.RtfToHtml()
    r.ImageStyle.IncludeImageInHtml = False	
    r.ImageStyle.ImageFolder = "d:\"
    r.ImageStyle.ImageSubFolder = ""  
    
  2. Why I don't see images in HTML after converting?

    Answer: If you don't see images in produced HTML there are several reasons:

    1. Images are stored inside HTML in binary base64 format and you are using old browser. This is supported only in IE8 and higher. To check how images are stored in HTML open your web-page in Notepad, if you will see something like this:
      <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARIAAABL .....">
      
      So images are stored in binary base64 format. To avoid this and save images as physical files on HDD, set the property SautinSoft.RtfToHtml.CImageStyle.IncludeImageInHtml to false.

      C#:
      r.ImageStyle.IncludeImageInHtml = false;

      VB.Net:
      r.ImageStyle.IncludeImageInHtml = False
    2. Don't forget to specify the properties SautinSoft.RtfToHtml.CImageStyle.ImageFolder and SautinSoft.RtfToHtml.CImageStyle.ImageSubFolder . The 'ImageFolder' must already exist and 'ImageSubFolder' will be created by the component. For example:

      C#:
      r.ImageStyle.ImageFolder = @"d:\my webs";
      r.ImageStyle.ImageSubFolder = "";  
                            

      VB.Net:
      r.ImageStyle.ImageFolder = "c:\local images"
      r.ImageStyle.ImageSubFolder = "pictures"
      To specify image name use the property SautinSoft.RtfToHtml.CImageStyle.ImageFileName.

  3. How to create HTML email with images in attachment from RTF using your component?

    Answer: You will find detailed answer in this article "How to create HTML email with embedded images from RTF in .Net".

HTML document

  1. How to change document title between tags <title>...</title>?

    Answer: It's very easy, simply fill the property SautinSoft.RtfToHtml.CTextStyle.Title by any string. For example:

    C#:
    SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
    r.TextStyle.Title = "This is my title!";
    VB.Net:
    Dim r As New SautinSoft.RtfToHtml()
    r.TextStyle.Title = "This is my title!"
  2. Is it possible to get only a part of HTML between tags <body>...</body>?

    Answer: Yes, sure it's not a problem for our component. To get a HTML part only between <body> tags, specify these properties:

    C#:
    SautinSoft.RtfToHtml r = new SautinSoft.RtfToHtml();
    r.HtmlParts = SautinSoft.RtfToHtml.eHtmlParts.Html_body;
    r.TextStyle.InlineCSS = true;
    VB.Net:
    Dim r As New SautinSoft.RtfToHtml()
    r.HtmlParts = SautinSoft.RtfToHtml.eHtmlParts.Html_body
    r.TextStyle.InlineCSS = True
Copyright © 2004-2017, SautinSoft™. All rights reserved.