Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert an rtf File to an html File?

Status
Not open for further replies.

tekrobg

Programmer
Oct 12, 2004
42
US
Is it possible to convert an rtf file, like one from an rtf text box, to an html file?

Thanks.
 
You can probably automate Word to do this. As far as writing your own algorithm, I wouldn't attempt it unless I had a LOT of time on my hands.
 
Microsoft Word will do it. Just open it and SaveAs click the dropdown box below and find htm or html
 
Will this text box contain only plain text? Or will it have variations, like Bold, color, etc?

 
The text box will have only plain text and bold text.
 
You can parse the text returned from RichTextBox1.rtf to find the rtf code for bold, and replace it with html tags for bold (<b> and </b>)

then put <html><head></head><body> tags before the text, and they corresponding closing tags after. save the file with a .htm extension.. you should be all set

this gets more complicated, of course, if you want to save color, bullets, etc.

Hopefully this helps, or at least points you in the right direction

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top