Re: Problems with RTFTOHTML

Subject: Re: Problems with RTFTOHTML
From: "Michael P. O'Lear" <molear -at- INRIRD -dot- COM>
Date: Mon, 27 Nov 1995 10:53:43 -0800

Keith Soltys -- ksoltys -at- io -dot- org -- http://www.io.org/~ksoltys/
wrote about using rtftohtml:

>RTFTOHTML would be good enough for my purposes, if I could get it to
>generate a table of contents linked to the headers in the document. According
>to the docs, it will do this, but I cannot get it to work using the styles
>that are in our documents. Our standard template uses the heading styles:
>Heading 1, Heading 2, Heading 3, and so on. RTFTOHTML expects: heading 1
>heading 2, heading 3, and so on. You can edit a translation table in one
>of the configuration files to allow for this, at least the docs say that you
>can, but I can't get it to work. I could write a macro to change the styles
>in our documents from "Heading n" to "heading n", but this adds an extra
>step to the conversion process.


Make sure "Table of Contents" is selected in the rtftohtml prefernces
dialog box (Choose PREFERENCES from the EDIT menu). If it is, you need to
make changes to the html-trans file.

You can make rtftohtml translate any MSWord style to an HTML style by
editing the text file named "html-trans".

Towards the end of that file is the PMatch table (for a portion of this
table, see the end of this message) that rtftohtml uses to translate a
paragraph style into an html file.

For headings to be used to create a table of contents, or to be converted
to html headings with the <H1>, <H2> codes, rtftohtml expects to see a
paragraph styles with the names:

heading 1,hd
heading 2,hd
heading 3,hd

etc.(see lines #9-11 in the PMatch table at the end of this message)

These are the default heading names in MSWord. If your paragraph heading
styles are different from these, rtftohtml will not convert your heading
stylesto HTML headings and will not create a Table of Conetnts for you
--unless you add the information in the html-trans file.

Here is what you need to do:
1. Find the html-trans file in your rtftohtml folder.
2. Make a copy of this file and give it a new name (like "html-trans_orig")
so if you muck up the html-trans file while editing it you can always go
back to the original htm-trans file.
3. Open the file using a word processor.
4. Within the html-trans file, find the PMatch table by searching for: PMatch
5. Find the section in the PMatch tabel that deals with headings (starts
with "heading 1,hd1",0,"h1").

"heading 1,hd1",0,"h1"

The text between the first set of quotation marks is the name of the
paragraph style that you want rtftohtml to translate. In this example, it
is: heading 1,hd1

The number after the style name refers to the html nesting level. All
headings are considered to be at the top level, so in this example it is: 0
(zero)

The text at the end of the line, between the second set of quotation marks,
is the name of the html style that will be used in place of the paragraph
style. In this case it is: h1.

6. To make rtftohtml recognize your style names in place of the ones in the
PMatch table, you can either edit the style name in the table or add a
conversion entry with your style name.

If your heading style names are "Heading 1", "Heading 2", etc (as in the
case with Keith Soltys) :

Edit the "heading 1,hd1",0,"h1" line to "Heading 1",0,"h1"
Edit the "heading 2,hd2",0,"h2" line to "Heading 2",0,"h2"
etc

NOTE: make sure you don't delete the quotation marks.

or

Add the line "Heading 1",0,"h1" after the line "heading 1,hd1",0,"h1"
Add the line "heading 2,hd1",0,"h2" after the line "heading 2,hd2",0,"h2"
etc

7. Save the file as a text file (NOT an MSWord or an rtf file) with the
name: html-trans.
8. Make sure the edited html-trans file is in the same folder as the
rtftohtml application.
9. Start rtftohtml.
10. Make sure "Table of Contents" is selected in the rtftohtml prefeernces
dialog box (Choose PREFERENCES from the EDIT menu).
11. From within rtftohtml open the rtf file you want to translate.

Your Heading 1, Heading 2 etc styles should now be translated to <H1>, <H2>
etc, and rtftohtml will use those styles to generate a separate ToC.html
file taht has links back to the headings in the main html file.


rtftohtml can be customized even more by editing the .PTag table. See the
documentation that comes with rfttohtml for more information.

rtftohtml (and the rtftohtml user's guide) is available from:
ftp://ftp.cray.com/src/WWWstuff/RTF/rtftohtml_overview.html


Hope this helps.

Portion of the PMtach table from the html-trans
file___________________________________

# Format:
# "Paragraph Style",NestLevel,"ParagraphStyleName"
# First Entry is the default if no style match. Should be level 0
# point to a Paragraph style with no markup
.PMatch
"Normal,n",0,"Normal"
# This is a required entry; tables will be formatted with this entry
"_Table",0,"_Table"
"heading 1,hd1",0,"h1"
"heading 2,hd2",0,"h2"
"heading 3,hd3",0,"h3"
"heading 4,hd4",0,"h4"


_______________________________

Mick O'Lear (aka Michael P. O'Lear)

Technical Editor/Writer
molear -at- inrird -dot- com (Inter-National Research Institute, Inc.)
619-621-6180
619-693-8297 (fax)

Work mailing address:
INRI
9740 Appaloosa Rd.
San Diego, CA 92131


Previous by Author: SUMMARY: HTML Products
Next by Author: Using software...
Previous by Thread: Problems with RTFTOHTML
Next by Thread: Re: Problems with RTFTOHTML


What this post helpful? Share it with friends and colleagues:


Sponsored Ads