Converts Text/RTF file to Text/HTML/XHTML file. Output file will be overwritten.
Namespace:
SautinSoftAssembly: SautinSoft.RtfToHtml (in SautinSoft.RtfToHtml.dll) Version: 3.0.2.0
Syntax
| C# | Visual Basic | J# |
Return Value
0 - converting succesfully1 - can't open input Text/RTF file, check the input path
2 - can't create output file, check the output path
3 - converting failed
Examples
using System; using System.IO; using System.Text; namespace SampleConvert { class Class1 { static void Main(string[] args) { SautinSoft.RtfToHtml rth = new SautinSoft.RtfToHtml(); //this property is necessary only for registered version //rth.Serial = "XXXXXXXXXXXXX"; //specify some options rth.OutputFormat = SautinSoft.eOutputFormat.XHTML_10; rth.Encoding = SautinSoft.eEncoding.UTF_8; string rtfFile = @"..\..\..\..\..\test.rtf"; string htmlFile = @"..\..\..\..\..\test.html"; int i = rth.ConvertFile(rtfFile,htmlFile); if (i==0) { System.Console.WriteLine("Converted successfully!"); System.Diagnostics.Process.Start(htmlFile); } else System.Console.WriteLine("Converting Error!"); } } }
Imports System Imports System.IO Imports System.Text Namespace SampleConvert Friend Class Class1 Shared Sub Main(ByVal args() As String) Dim rth As New SautinSoft.RtfToHtml() 'this property is necessary only for registered version 'rth.Serial = "XXXXXXXXXXXXX"; 'specify some options rth.OutputFormat = SautinSoft.eOutputFormat.XHTML_10 rth.Encoding = SautinSoft.eEncoding.UTF_8 Dim rtfFile As String = "..\..\..\..\..\test.rtf" Dim htmlFile As String = "..\..\..\..\..\test.html" Dim i As Integer = rth.ConvertFile(rtfFile,htmlFile) If i=0 Then System.Console.WriteLine("Converted successfully!") System.Diagnostics.Process.Start(htmlFile) Else System.Console.WriteLine("Converting Error!") End If End Sub End Class End Namespace