How to Convert RTF to HTML in C#, VB.NET

Spire.Doc allows users to use C#/VB.NET to convert RTF to HTML. And it's the same easy as conversion from Word to HTML. Now, follow the simple steps to use C#/VB.NET to convert RTF to HTML.

Note: Please make sure Spire.Doc and Visual Studio (Version 2008 or later) are correctly installed on your system.

Step 1: Create Project

Create a windows forms application project in your visual studio and add Spire.Doc dll as reference. Generate a button and double click to go to step 2.

Step 2: C#/VB.NET RTF to HTML Conversion

Spire.Doc offers an easy solution to convert RTF to HTML. Copy and paste the simple C# and VB.NET code into the project.

            Document document = new Document();
            document.LoadFromFile(@"D:\Work\Stephen\2012.02.09\C# Create Excel.rtf");
            document.SaveToFile("sample.html", FileFormat.Html);
Dim document As New Document()
document.LoadFromFile("D:\Work\Stephen\2012.02.09\C# Create Excel.rtf")
document.SaveToFile("sample.html", FileFormat.Html)

Step 3: Save and Preview

To fast preview the effect of RTF to HTML conversion, we can use the code below to save and start project.

        private void WordDocViewer(string fileName)
            catch { }
Private Sub WordDocViewer(fileName As String)
	End Try
End Sub

Effective Screeshot:

Spire.Doc is a professional word component which enables developers/programmers to fast generate, read, write and modify Word document for .NET and Silverlight. It supports C#, VB.NET, ASP.NET, ASP.NET MVC and Silverlight.