Opening external files in HtmlHelp
Previous Topic  Next Topic 

Let's say you want to click a text link and display an MS Word document. If the file is on the internet or you want to specify the full path:

  1. Highlight your link text and press F4 to create a link
  2. Select "Internet" as the link type and in the "Link to the following Internet url:" field, type in
    Or, if it is a file on your Intranet or local drive, type in:

In each case above, the MS Word doc will be loaded within your HtmlHelp file, so it appears to be embedded in your page. If you want to load the external file separately from your HtmlHelp file, do the following:

  1. Select "Insert | HtmlHelp Control | ShortCut"
  2. In the Caption field, type in the name of your MS Word document or anything else you want your users to see.
  3. In the "Program" field, type in the path to your .doc file, i.e.
    and click OK
  4. When you compile, your users will see a button that when clicked will load the .doc file.

Using Relative Directory Addressing

Sometimes it may not be possible to know the full path to where a file is located, so we added a JavaScript function called "OpenFileRelativeToCHMFolder". This function is automatically added to your Project when you compile. Let's say you have a file called "YourMSWord.doc" and it is located in a known folder, which is a sub-folder of where the CHM file will be loaded from, i.e. "C:\..\YourApplication\SupportFiles\Docs".

To use this function you need to use Html.

  1. Select "Insert | HtmlHelp Control | <TAG>" and type in the following html:
    <a onclick="OpenFileRelativeToCHMFolder('SupportFiles\\Docs\\YourMSWordDoc.doc')" style="text-decoration: underline; color: blue; cursor: hand">Click here to display your MS Word doc</a>
    The important thing to remember is to use double-backslashes when referring to folder paths.
  2. Click OK and compile and your will see the link text and when you click on it, it will display your Word file if it exists in the sub-folders you specified.