Using a VB.NET 2005 Class to Convert RichText to HTML






4.55/5 (28 votes)
A quick way to convert RichText to HTML.
Introduction
This code was written to solve the problem of having RichText data needing to be displayed in HTML, both in HTML reports and in ASP.NET web pages.
Using the code
Use of the code is exceptionally simple. Simply create a new instance of the class and then use the properties to first pass in the RichText to parse and then use the html
property to get the resulting HTML. (The code file for the class is attached to this article).
''Assume you have a RichTextBox on your
''form named rtbFoo and a button named btnBar
Private Sub btnBar_Click(ByVal sender as object, _
e as System.EventArgs) Handles btnBar.Click
dim r2h as new RTFtoHTML
r2h.rtf = rtbFoo.rtf
messagebox.show(r2h.html)
End Sub
History
- Initial release - 11/02/2006.