Click here to Skip to main content
Click here to Skip to main content

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

By , 2 Nov 2006
 

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)

About the Author

George H. Slaterpryce III
Architect
United States United States
Member
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#.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionAre you kidding me!?memberFuck you assholes30 Jul '12 - 5:09 
AnswerRe: Are you kidding me!?memberGeorge H. Slaterpryce III30 Jul '12 - 10:07 
Questionc#memberJheiron29 Jun '12 - 7:51 
AnswerRe: c#memberGeorge H. Slaterpryce III30 Jul '12 - 10:08 
Questionhow can I use with Strike tag?memberkals8420 Dec '11 - 1:53 
QuestionNew ReleasememberGeorge H. Slaterpryce III5 Dec '11 - 21:18 
AnswerRe: New ReleasememberChitation4 Jan '12 - 11:31 
AnswerRe: New Releasemember98z2831 Mar '12 - 11:35 
AnswerRe: New Releasemembersimon Barnby9 Aug '12 - 22:00 
Answervery nice code & good readers hint.membernasimb16 Nov '11 - 3:00 
Questiondisplay html format in vb.netmemberepit2429 Sep '11 - 17:04 
QuestionFix for .NET4 and VS2010memberJohnnyasdf11 Sep '11 - 12:36 
BugA little bug?member98z2813 Aug '11 - 8:38 
GeneralRe: A little bug?memberGeorge H. Slaterpryce III15 Aug '11 - 16:31 
GeneralRe: A little bug?member98z2817 Aug '11 - 9:18 
GeneralRe: A little bug?memberJohnnyasdf10 Sep '11 - 13:54 
QuestionConversion of text in textbox to HTML filememberAdarshPatil25 Nov '10 - 19:35 
GeneralUnderlinememberkheonline6 Oct '10 - 4:30 
QuestionCombined with RTBExVBmemberbigbro_19858 Aug '10 - 20:29 
AnswerRe: Combined with RTBExVBmemberGeorge H. Slaterpryce III3 Sep '10 - 9:57 
GeneralCode for changing the Font and the FontSize with ListBoxmembervb_newsbie12 Jul '10 - 21:14 
GeneralRe: Code for changing the Font and the FontSize with ListBoxmembervb_newsbie14 Jul '10 - 0:16 
GeneralHi George Slaterpryce IIImemberCurtis Underwood17 May '10 - 6:38 
GeneralRe: Hi George Slaterpryce IIImemberGeorge H. Slaterpryce III3 Sep '10 - 9:58 
GeneralNice Articlememberjayeshshah8 Dec '09 - 16:55 
GeneralBugsmemberhristo14220 Apr '09 - 21:55 
GeneralRe: BugsmemberSorwen30 Apr '09 - 6:59 
GeneralRe: Bugsmemberjoseph_man6 May '09 - 4:02 
GeneralRe: BugsmemberSorwen5 Jun '09 - 17:03 
GeneralRe: BugsmemberDjBepy15 Jul '09 - 2:22 
GeneralRe: Bugsmemberwouterdebo3 Feb '10 - 22:10 
GeneralRe: BugsmemberSorwen4 Feb '10 - 11:30 
AnswerRe: Bugsmemberamitk86 Dec '10 - 10:42 
Generalhimembermwau25 Feb '09 - 23:01 
GeneralNot saving any imagemembersuis11 Feb '09 - 6:40 
GeneralHey.. good one ..memberAbhishek sur27 Aug '08 - 22:00 
Generalsaving the converted filememberquioske9 May '08 - 3:57 
GeneralNicememberGlimmerMan6 Aug '07 - 3:09 
Generalescape charactersmembergary73 Aug '07 - 10:52 
GeneralUnderlinememberfrederic.robert29 May '07 - 5:02 
GeneralRe: UnderlinememberGeorge H. Slaterpryce III18 Jul '07 - 13:29 
GeneralGreat workmemberKaushal Mca16 May '07 - 2:23 
GeneralBulletsmembercraver8413 May '07 - 0:57 
GeneralRe: Bulletsmemberbigbro_19859 Aug '10 - 0:54 
Generalrtf2HTML - Example Source codememberRajesh Moriyani2 Jan '07 - 1:59 
GeneralHTML wordmemberpablleaf3 Nov '06 - 7:21 
GeneralRe: HTML wordmemberGeorge H. Slaterpryce III3 Nov '06 - 7:24 

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

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 2 Nov 2006
Article Copyright 2006 by George H. Slaterpryce III
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid