Click here to Skip to main content
Click here to Skip to main content
Go to top

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

, 2 Nov 2006
Rate this:
Please Sign up or sign in to vote.
A quick way to convert RichText to HTML.

A window showing a Rich Editor and the resutling HTML code

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

George H. Slaterpryce III
Architect
United States United States
Developing software since 1995, starting out with Borland Turbo C++ 3 & Motorolla Assembly.
Eventually learning several different languages such as
Pascal/Delphi,Basic, Visual Basic,FoxPro, ASP, PHP, and Perl.
 
Currently using the .net framework for most development task.
 
Hobbies include underwater robotics, and electronics.
 
George's current language of choice is C#.

Comments and Discussions

 
QuestionConversion of text in textbox to HTML file PinmemberAdarshPatil25-Nov-10 19:35 
GeneralUnderline Pinmemberkheonline6-Oct-10 4:30 
QuestionCombined with RTBExVB Pinmemberbigbro_19858-Aug-10 20:29 
AnswerRe: Combined with RTBExVB PinmemberGeorge H. Slaterpryce III3-Sep-10 9:57 
GeneralCode for changing the Font and the FontSize with ListBox Pinmembervb_newsbie12-Jul-10 21:14 
GeneralRe: Code for changing the Font and the FontSize with ListBox Pinmembervb_newsbie14-Jul-10 0:16 
GeneralHi George Slaterpryce III PinmemberCurtis Underwood17-May-10 6:38 
GeneralRe: Hi George Slaterpryce III PinmemberGeorge H. Slaterpryce III3-Sep-10 9:58 
Awesome
GeneralNice Article Pinmemberjayeshshah8-Dec-09 16:55 
GeneralBugs Pinmemberhristo14220-Apr-09 21:55 
GeneralRe: Bugs PinmemberSorwen30-Apr-09 6:59 
GeneralRe: Bugs Pinmemberjoseph_man6-May-09 4:02 
GeneralRe: Bugs PinmemberSorwen5-Jun-09 17:03 
GeneralRe: Bugs PinmemberDjBepy15-Jul-09 2:22 
GeneralRe: Bugs Pinmemberwouterdebo3-Feb-10 22:10 
GeneralRe: Bugs PinmemberSorwen4-Feb-10 11:30 
AnswerRe: Bugs Pinmemberamitk86-Dec-10 10:42 
Generalhi Pinmembermwau25-Feb-09 23:01 
GeneralNot saving any image Pinmembersuis11-Feb-09 6:40 
GeneralHey.. good one .. PinmemberAbhishek sur27-Aug-08 22:00 
Generalsaving the converted file Pinmemberquioske9-May-08 3:57 
GeneralNice PinmemberGlimmerMan6-Aug-07 3:09 
Generalescape characters Pinmembergary73-Aug-07 10:52 
GeneralUnderline Pinmemberfrederic.robert29-May-07 5:02 
GeneralRe: Underline PinmemberGeorge H. Slaterpryce III18-Jul-07 13:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 2 Nov 2006
Article Copyright 2006 by George H. Slaterpryce III
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid