TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
>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:
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").
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
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"
NOTE: make sure you don't delete the quotation marks.
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"
7. Save the file as a text file (NOT an MSWord or an rtf file) with the
8. Make sure the edited html-trans file is in the same folder as the
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.
Portion of the PMtach table from the html-trans
# "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
# This is a required entry; tables will be formatted with this entry
Mick O'Lear (aka Michael P. O'Lear)
molear -at- inrird -dot- com (Inter-National Research Institute, Inc.)
Work mailing address:
9740 Appaloosa Rd.
San Diego, CA 92131