Thanks for the advice, I've taken a closer look at RTF::HTML::Converter and a few other RTF packages because of it.

Unfortunately, none of those quite satisfy the goals I had for a number of reasons. First of all, although I may be mistaken, each of those seems designed to output to another file. I wanted something completely internal that wouldn't need to create a temporary file for various functions.

Why I believe an external file is needed:
I have no clue how to access the RE field AS RTF data. The only method of getting at it in that format that I know of is to have it save to a file and then read it in again. The same problem applies to the RTF2HTML thing, you would need to save it and have it read in once more by the RichEdit field. If this isn't true, I would REALLY like to be told how to avoid the external file.

The only redeeming quality to my method is that it's self-contained (for the most part at least). It isn't forced to output to a file first. I don't really mean to say that my way is better than the others because of it, just better suited to my needs, and I rather hoped that someone else could benefit from what I developed anyway.

I do plan on using HTML::Parser as I said before, though I'm rather unfamiliar with it so this could take time.

Thank you for the suggestions and advice.

Original Message:
---------------------------------------------
Well, for converting HTML to RTF, I believe Johan was meaning that you should be using an HTML parser AND a RTF Generator to:

read HTML file watching for events when an event happens check the event data such as what tag fired the event and then pass that info along with the (tag) data off to the RTF generator object.

This would be very similar to how the XML::SAX* modules work. I have not really worked with the XML::SAX* modules but a few times, but basically, you write your own package object and use XML::SAX* to capture events in the HTML source file. It passes these to your package subs, which you can then do conditional processing based on what event is sent. And then, you pass this data to where ever you need (usually an XML writer. Basically, this is a way to transform one xml document into something else, either XML, HTML, CSV, or whatever format you can write up).

While going with this approach would take a little longer:
1)its main advantage is that it is easier to package into a real module to share (hint)
2) its extensable
3) with the events already defined in HTML and the events already defined in RTF output, it will be far less work to change the parsing rules then the role your own approach taken in the sub below.(you dont have to worry about.

I can "agree" with you on your point about RTF::Parser's lack of documentation, but it still is a decent prebuilt package. Generally, "we" end up missing something when trying to do something manually that a module already has been built to do.

I tried the RTF::Parser's rtf2html.bat and found it did a very good job. Now, granted, I did not pass anything odd into it the html file, but it created very nice HTML output.

Hope this helps.

Joe Frazier, Jr.
Technical Support Engineer
Peopleclick Service Support

Tel:  +1-800-841-2365
E-Mail: mailto:[EMAIL PROTECTED]

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com


Reply via email to