Home
Download your own copy of Doc To HTML Converter today!Prev Page Prev Page
Introduction
Using DocToHtml
Getting Started
Conversion Options Dialog
General
Output Filenames
Template Data Editor
Images
Meta Tags
CSS
Advanced
JavaScript
HTML Code
Font Attr
Paragraph Attr
List Attr
Table Attr
Text Boxes
Body & Footer
Footnotes & Endnotes Options
HTML Template
XML & Charset & PG
Browsers
Search & Replace
Batch
Filemasks
Progress Form
Batch Converter
Main Window
Settings Dialog
General
Memory
Timeouts
Command Line Support
Search & Replace Dialog
Installation Issues
Uninstallation Issues
Crash Recovery
Support for 64-Bit MS Word
Troubleshooting
Common Issues
Deep Troubleshooting
Registration Benefits
How to Buy
Support & Feedback
FAQ
How to Speed up the Conversion
Unsupported Formatting
License Agreement
Privacy Policy
Change Log
Credits
Other Products

Using JavaScript in DocToHtml


Fields selection or JavaScript processing dialog

The dialog shown above lets you select specific MS Word fields to be processed using JavaScript. Some field types are not displayed here because it is no use processing the corresponding MS Word fields using JavaScript. Currently the “useless” fields are Embed, Hyperlink, Include Picture, Formula, and Reference. Index Entry (XE) fields are processed differently from others (see output (X)HTML code for details). For the JavaScript program to generate an Index for you, check the XE checkbox; otherwise DocToHtml simply will not insert the appropriate marks. The same applies to the TC (Table of Contents Entry) fields. Note that for the above dialog to take effect and even be available, the “Convert MS Word fields to JavaScript” option must be enabled on the Advanced Tab of the Conversion Options dialog.

To convert a field, DocToHtml must be able to find the appropriate JavaScript file in a subfolder of the SCRIPT folder. The SCRIPT folder is located in the DocToHtml installation folder (which is usually C:\Program files\DocToHtml). DocToHtml looks for a file with the same name as the MS Word field with the .js extension. For example, the filename would be “toc.js” for the TOC field (Table of Contents), “date.js” for the DATE field, and so on. The entry in the first column, MS Word Name, is an internal MS Word short field name (acronym) that will be searched for. This is what you see as the first word of a field code in a MS Word document when you check the “Show hidden text” checkbox in MS Word. The search is first done in the subfolder named after the target browser (for instance, Explorer, Firefox, or Opera). If nothing is found, the search will continue in the “Any” subdirectory of the SCRIPT folder. If found, the script will be inserted into the output HTML document. You can also write your own scripts. To learn how to interface them with the rest of HTML generated by DocToHtml, study the .js files included in the installation, and check out the generated docs. If DocToHtml cannot locate any ready-to-use script replacement for a MS Word field, a red-colored MS Word field code text will be displayed in that place in the resulting document.

To use the <DIV> tag as a container for a field, place the //block comment on the first line of your custom script file. Otherwise, DocToHtml will use the <SPAN> tag as a container for that field.

As usual in web development, errors are possible when executing scripts in different browsers. We do our best to keep the scripts that come with the DocToHtml installation as error-free and up-to-date as possible. But we cannot guarantee that all our scripts will work smoothly on all platforms. Please keep that in mind. Refunds will not be issued on the basis of script errors.

If you find an error or make a significant improvement to any script that comes with DocToHtml, you will get a 50 percent discount when purchasing the program. If you send us a new script that can handle a previously unsupported MS Word field, you will get a free registration key or a 75 percent discount. Please read the remark below.

Any error will be regarded as such only if it manifests itself in one of the four major browsers: Internet Explorer, Firefox, Chrome, or Opera. The error must manifest itself in the most recent browser version, or at least in a version not older than one year. Please make sure that you are using the latest version of DocToHtml. When sending us a new script, or a bugfix to an existing script, please always enclose information on how your script or bugfix was tested, including specific browser and OS versions, information from DocToHtml’s “System Info” window, and the original MS Word document containing the specific field your script operates on, to demonstrate how it works. To get a free registration key, you must send us a script that works in the latest version of each of the above-mentioned four major browsers. To get a 75 percent discount, you must send us a script that works in at least one of the above-mentioned four browsers. Please send your e-mails to feedback@opilsoft.com.