Click here to Skip to main content
Licence CPOL
First Posted 2 Nov 2006
Views 77,399
Downloads 1,927
Bookmarked 69 times

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

By George H. Slaterpryce III | 2 Nov 2006
A quick way to convert RichText to HTML.
2 votes, 11.1%
1
1 vote, 5.6%
2
1 vote, 5.6%
3
3 votes, 16.7%
4
11 votes, 61.1%
5
4.41/5 - 18 votes
2 removed
μ 3.88, σa 2.54 [?]

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

Web Developer

United States United States

Member
George is a full time software developer and owner employed by Captovis Advanced Industries and part owner of Bridges Software Group (A software company that writes software for the medical industry).
 
He has been programming since 1995, starting out with Borland Turbo C++ 3 and eventually learning several different languages such as
Pascal/Delphi,Basic,ASM,Visual Basic,FoxPro, ASP, PHP, and Perl.
 
George's current language of choice is VB.NET 2005.

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

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questionhow can I use with Strike tag? Pinmemberkals842:53 20 Dec '11  
QuestionNew Release PinmemberGeorge H. Slaterpryce III22:18 5 Dec '11  
AnswerRe: New Release PinmemberChitation12:31 4 Jan '12  
Answervery nice code & good readers hint. Pinmembernasimb4:00 16 Nov '11  
Questiondisplay html format in vb.net Pinmemberepit2418:04 29 Sep '11  
QuestionFix for .NET4 and VS2010 PinmemberJohnnyasdf13:36 11 Sep '11  
BugA little bug? Pinmember98z289:38 13 Aug '11  
GeneralRe: A little bug? PinmemberGeorge H. Slaterpryce III17:31 15 Aug '11  
GeneralRe: A little bug? Pinmember98z2810:18 17 Aug '11  
GeneralRe: A little bug? PinmemberJohnnyasdf14:54 10 Sep '11  
QuestionConversion of text in textbox to HTML file PinmemberAdarshPatil20:35 25 Nov '10  
GeneralUnderline Pinmemberkheonline5:30 6 Oct '10  
QuestionCombined with RTBExVB Pinmemberbigbro_198521:29 8 Aug '10  
AnswerRe: Combined with RTBExVB PinmemberGeorge H. Slaterpryce III10:57 3 Sep '10  
GeneralCode for changing the Font and the FontSize with ListBox Pinmembervb_newsbie22:14 12 Jul '10  
GeneralRe: Code for changing the Font and the FontSize with ListBox Pinmembervb_newsbie1:16 14 Jul '10  
GeneralHi George Slaterpryce III PinmemberCurtis Underwood7:38 17 May '10  
GeneralRe: Hi George Slaterpryce III PinmemberGeorge H. Slaterpryce III10:58 3 Sep '10  
GeneralNice Article Pinmemberjayeshshah17:55 8 Dec '09  
GeneralBugs Pinmemberhristo14222:55 20 Apr '09  
GeneralRe: Bugs PinmemberSorwen7:59 30 Apr '09  
GeneralRe: Bugs Pinmemberjoseph_man5:02 6 May '09  
GeneralRe: Bugs PinmemberSorwen18:03 5 Jun '09  
GeneralRe: Bugs PinmemberDjBepy3:22 15 Jul '09  
GeneralRe: Bugs Pinmemberwouterdebo23:10 3 Feb '10  

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.

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