Set input format: Text or Html

Namespace:  SautinSoft
Assembly:  SautinSoft.HtmlToRtf (in SautinSoft.HtmlToRtf.dll) Version: 5.8.2.8

Syntax

      
 C#  Visual Basic 
public HtmlToRtf..::.eInputFormat InputFormat { get; set; }
Public Property InputFormat As HtmlToRtf..::.eInputFormat

Remarks

By default it's set to Html.



Examples

CopyHow to convert Text file to RTF file in C#
using System;
using System.IO;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {
            // Convert Text file to RTF file
            // If you need more information about "HTML to RTF .Net" email us at:
            // support[at]sautinsoft.com        
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
            // After purchasing the license, please insert your serial number here to activate the component
            //h.Serial = "XXXXXXXXXXXXXXX";

            DirectoryInfo htmlDir = new DirectoryInfo(@"..\..\..\..\..\..\Testing HTMLs");
            string textFile = Path.Combine(htmlDir.FullName, "Document.txt");
            string rtfFile = Path.ChangeExtension(textFile, ".rtf");

            // Please don't forget to specify 'InputFormat' as 'Text'.
            h.InputFormat = SautinSoft.HtmlToRtf.eInputFormat.Text;

            // Convert Text to RTF
            int res = h.ConvertFile(textFile, rtfFile);

            if (res == 0)
            {
                Console.WriteLine("Converted successfully!");
                System.Diagnostics.Process.Start(rtfFile);
            }
            else
            {
                Console.WriteLine("Converting failed!");
                Console.ReadLine();
            }
        }
    }
}
CopyHow to convert Text file to RTF file in VB.Net
Imports System
Imports System.IO
Imports System.Text

Module Module1
    Sub Main()
        ' Convert Text file to RTF file
        ' If you need more information about "HTML to RTF .Net" email us at:
        ' support[at]sautinsoft.com        
        Dim h As New SautinSoft.HtmlToRtf()
        ' After purchasing the license, please insert your serial number here to activate the component
        'h.Serial = "XXXXXXXXXXXXXXX";


        Dim htmlDir As New DirectoryInfo("..\..\..\..\..\Testing HTMLs")
        Dim textFile As String = Path.Combine(htmlDir.FullName, "Document.txt")
        Dim rtfFile As String = Path.ChangeExtension(textFile, ".rtf")

        ' Please don't forget to specify 'InputFormat' as 'Text'.
        h.InputFormat = SautinSoft.HtmlToRtf.eInputFormat.Text

        ' Convert Text to RTF
        Dim res As Integer = h.ConvertFile(textFile, rtfFile)

        If res = 0 Then
            Console.WriteLine("Converted successfully!")
            System.Diagnostics.Process.Start(rtfFile)
        Else
            Console.WriteLine("Converting failed!")
            Console.ReadLine()
        End If
    End Sub
End Module

See Also