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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Freeware RTF2HTML procedure?

Status
Not open for further replies.

wilfranz

Technical User
Oct 4, 2003
122
0
0
US
Hello friends,

Does anyone know if there is a freeware (or inexpensive shareware) RTF2HTML procedure or module or ActiveX out there? There are a number of nice-looking ones available,
but they are all >$100.

TIA

wilfranz
 
How about Word? It wouldn't be too hard to automate an open-saveas-html.

Check out the FAQ areas for word automation examples.

Brian
 
Thanks for your replies, Brian and Mike.

Your suggestions won't fit my need. My fault, I wasn't very specific about what I wanted.

I need a converter module in the form of a function/procedure (even code-only would be good) -- want to avoid an intermediate UI (such as Word or DocToHtml). It is needed on a Form to translate RTF-formatted memo fields so they can be viewed and edited, on the Form, in an HTML-based control. The conversion needs to be instantaneous without any operator input, and to not hop back and forth between Word or another Editor.

I was wondering if anyone has posted the code anywhere to do this. Thanks for any further input.

Bill
 
Bill,

It wouldn't be enormously difficult to write your own converter. RTF and HTML are both tag-based languages, so it would basically be a matter of translating the tags.

That said, it would probably cost more than $400 of your time, so maybe going with Rick Schummer's suggestion would be a better bet.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-consult.com)
 
Thanks very much for your replies and thoughts, Rick and Mike.

Mike, You hit the nail on the head. I have now decided that writing my own will indeed be the way to go. Because I am retired and now a hobbyist VFP programmer, I have plenty of time, whereas dollars need to be treated kindly (rather than the other way around).

I am not adverse to doing my own, in fact I would enjoy it. I just hoped that someone had done so already and posted code. And although, as you point out, RTF and HTML are both tag-based, RTF uses a different approach than HTML to "turning-off" its formatting codes, which does not lend itself to simple search and replace conversion. (It will probably require a stack structure to keep track of.)

If you have any hints about sites that would have postings about this, I would be obliged to know them.

Thanks again,

Bill
 
Bill,

Well, it sounds like a fun project. If you ever get it off the ground, I hope you'll share the results with us.

If you have any hints about sites that would have postings about this, I would be obliged to know them.

I don't know of any sites off-hand, but a Google search might locate some. (My own site has an article about storing RTF text in the clipboard, but that's not really relevant to what you are trying to do.)

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-consult.com)
 
Bill

I rencently wrote a piece for a French VFP group's website on "how to format an RTF document in your FoxPro report". The idea was to find full justification in a text box that eminated from a memo field. And as you know (or may not )Full justication is impossible to achieve in a VFP report although GDI+ plus in VFP9.0 reports it can), but I know this is unrelated your ques, but I found the RTF specs usefull to me, perhaps this link might be of interest.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks very much for your input Mike. I checked out the link and find that it has Ver 1.7 of the RTF specs. I had been using Ver 1.5, and the newer one is much better formatted (Word rather than HTML document) and easier to navigate and search. (Not to mention up-to-date.)

I appreciate (more than you would suspect) your challenge of creating full justification code for screen display. In a previous life I was a type-setter (that's right, hard lead type, and that REALLY dates me!) and we called it "straight justification" then. It was performed by counting the space remaining at the end of a line of type, counting the words, and then doing quick arithmetic in your head to divide up and add, or subtract space between words, using very thin spaces placed between each word. Then, when I had my first encounter with a word processor (1982) it felt like I had died and gone to heaven! Since then I have played around with trying to duplicate this programmatically both on screen and with a laserjet, but always with less-than-perfect results.

Again I send many thanks to you and all the MVPs and "gurus" there at Tek-Tips, who generously provide your time, patience, and expertise with those of us who dwell closer to the bottom.

BillvV
 
Wilfranz

French may not be a language you are familliar with, but to show you how I dealt with the full justification on a textbox in a VFP report, here is the article (The full justication is the last code sample)

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks Mike. I did check out the French article and I find it of much interest. I wasn't aware that RTF allowed for full justification (FJ). Also a little more checking tells me that it must be fairly new to RTF controls, because I could not force my VFP RTF Control, or my WordPad utility to display FJ even when I manually added a \qj to the raw text -- but Word2000 would display it properly (with the same \qj-added raw text).

My VFP RTF Control is "Ver 6.0 (SP4)". It probably was installed with my VFP8. Is there now a later one? If so, where can I obtain it? Is it maybe standard with VFP9? I see that Hallogram sells one that boasts FJ, but I can't spend the bucks for it.

Thanks for your input.

Bill
 
My VFP RTF Control is "Ver 6.0 (SP4)". It probably was installed with my VFP8. Is there now a later one? If so, where can I obtain it? Is it maybe standard with VFP9? I see that Hallogram sells one that boasts FJ, but I can't spend the bucks for it.

Honnestly, I have not done anything different, or downloaded anything special to achieve this. When I wrote the article, I was acutally basing it on the 1.5 specs, which as you will notice has the "qj", which is what I used in the example.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
baltman / wilfranz:

But you can automate word without displaying user interface (.Visible=.f.), isn't it?
 
Thanks for your reply foxdbs,

Yes, I think you can automate Word in non-visible mode. But what I'm looking for is an HTML editing control (like the RTF Edit Box) to place on a form in an existing app, to edit/format a document with HTML, then send it via email automating OUTLOOK.

For Mike Gagnon: Mike I have checked out my RTF control, MS RichText Box Ver 6.0 (SP4), and it definitely doesn't support the \qj tag. I would be very curious to know what ocx you are using. Maybe I can find one like it.

Thanks guys.

Bill
 
Have you tried the example in the article? This requires you the create a report called rtfdemo and add a textbox on it.
Code:
CLEAR ALL
CLOSE DATABASES all
LOCAL lcStr
lcstr = "Note that there is a limit of 32 characters total for the sum of text"+;
 "before and text after for simple numbering. Multilevel numbering has a limit"+;
  "of 64 characters total for the sum of all levels.NOTE: The file must have a"+;
   ".RTF extension to work properly."+;
   "Note that there is a limit of 32 characters total for the sum of text"+;
 "before and text after for simple numbering. Multilevel numbering has a limit"+;
  "of 64 characters total for the sum of all levels.NOTE: The file must have a"+;
   ".RTF extension to work properly."
CREATE cursor ctext (lctext m,gText g) 
INSERT INTO ctext (lctext) VALUES (lcStr)
_rtfFile = "c:\"+SYS(3)+".rtf" 
SCAN 
   SET TEXTMERGE TO &_rtfFile NOSHOW
   SET TEXTMERGE ON
   \\{\rtf1\ansi\qj <<ALLT(cText.lcText)>>}
   SET TEXTMERGE TO
   APPEND GENERAL gText FROM &_rtfFile CLASS "RICHTEXT.RICHTEXTCTRL.1"
ENDSCAN
REPORT FORM rtfdemo PREVIEW NOCONSOLE



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Bill,

Yes, I think you can automate Word in non-visible mode. But what I'm looking for is an HTML editing control (like the RTF Edit Box) to place on a form in an existing app, to edit/format a document with HTML

Yes, I can see that would be a good approach. In theory, you could drop an OLE Bound control on the form, and bind it to a General field containing a Word document. But it would be slow, and a bit clumsy.

Sounds like you would be better off using the RTF control, or something similar, and writing your own code to translate the tags to HTML.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top