Click to See Complete Forum and Search --> : Question: Text to HTML?
Adamaran
April 30th, 2008, 07:41 PM
Basically I am looking for ideas. I created a text file editor, but I am looking to be able to convert all of the text in the RTF text box to an HTML file. What would be way to go about this? I've tried looking for some examples, but haven't had any luck.
Thanks.
dglienna
May 1st, 2008, 12:22 AM
Just the text? That isn't too hard, but a rtb can hold a lot more than text
PeejAvery
May 1st, 2008, 07:28 AM
Google has a lot to say about RTF to HTML (http://www.google.com/search?source=ig&hl=en&rlz=&q=rtf+to+html&btnG=Google+Search). There is even a CodeGuru article (http://www.codeguru.com/cpp/controls/richedit/conversions/article.php/c5377/) about this. Granted, it is in VC++, but it wouldn't be hard to port it over.
Adamaran
May 1st, 2008, 08:51 AM
Actually Google doesn't have a lot to say. Most of those links are selling programs that do it and are pretty outdated. I've downloaded about 5 trial versions. One of the programs sells for well over $200.00!
To answer dglienna, what I did was create the RichTextBox control that I can open regular text files to that contain ANSI color codes and such, as well as RTF files. Opening and saving plain text is quite simple. It's the Rich Text format that isn't so easy. Trying to convert all of the ANSI color codes, and other color formats and so on to HTML is where I am a little lost.
I was wondering how you would do regex matching in this case or use the Find method to search through all of the text and replace all instances of color codes and so on? How you add <br> to each line and so on.
I'm no guru by any means. I've just started to learn VB.NET. The book I read on Visual Basic did not cover any of this stuff, so I am figuring it out at present.
Thanks.
PeejAvery
May 1st, 2008, 09:09 AM
Actually Google doesn't have a lot to say. Most of those links are selling programs that do it and are pretty outdated. I've downloaded about 5 trial versions. One of the programs sells for well over $200.00!
You know, if you add the word free to the search...you will probably find something that is free! ;)
Most of it is going to be simple text/character replacing. You can take a look at the characters for RTF here (http://www.biblioscape.com/rtf15_spec.htm).
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.