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.
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); WordDocViewer("sample.html");
Dim document As New Document() document.LoadFromFile("D:\Work\Stephen\2012.02.09\C# Create Excel.rtf") document.SaveToFile("sample.html", FileFormat.Html) WordDocViewer("sample.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) { try { System.Diagnostics.Process.Start(fileName); } catch { } }
Private Sub WordDocViewer(fileName As String) Try System.Diagnostics.Process.Start(fileName) Catch 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.