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

 
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 
You actually create a line of HTML for every single individual letter??!?! OMFG
AnswerRe: Are you kidding me!?memberGeorge H. Slaterpryce III30 Jul '12 - 10:07 
In this version probably. It is the very first version. In yhe c# version no. As it takes and parses the raw rtf.
 
Now here is an idea. The code is out there free and open you could improve it and post your own version with fixes or you can continue being abusive about it. I dont care which... but really? Do you feel more important now?
 
One of these days i will release the new version when i have time. On that day a whole host of issues will be fixed. Until then you will just have to deal. Or see other examples that are on codeproject dealing with this.
Questionc#memberJheiron29 Jun '12 - 7:51 
you have that class in c#?
AnswerRe: c#memberGeorge H. Slaterpryce III30 Jul '12 - 10:08 
Yes but its the new version.
Questionhow can I use with Strike tag?memberkals8420 Dec '11 - 1:53 
awesome article..
but still missing strike string.
can anybody tell me how to use strikethrough ?
QuestionNew ReleasememberGeorge H. Slaterpryce III5 Dec '11 - 21:18 
The next version of this code has been released as invite beta. As soon as I have the big bugs worked out (mainly having problems with images) I'll create a new CP article.
 
Anyone interested in helping with the beta?
AnswerRe: New ReleasememberChitation4 Jan '12 - 11:31 
I'm interested
AnswerRe: New Releasemember98z2831 Mar '12 - 11:35 
Definitely! Would also love to see what all you added/changed/fixed. Smile | :)
AnswerRe: New Releasemembersimon Barnby9 Aug '12 - 22:00 
Any news on the next release, a very interesting project...
Answervery nice code & good readers hint.membernasimb16 Nov '11 - 3:00 
i realy wait 4 ur new version.

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

Permalink | Advertise | Privacy | Mobile
Web01 | 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