Merging HTML files into topics

Navigation:  Basic Working Procedures > Importing Data >

Merging HTML files into topics

Previous pageReturn to chapter overviewNext page

Show/Hide Hidden Text

In addition to importing HTML and text files you can also use a command that enables you to merge external HTML files into existing topics at publish time. This can be very useful if you have material that changes frequently. You can maintain it in an external HTML file and automatically merge the latest version into your project when you publish.

 

flag_green        Key Information

This only works in HTML-based output formats. Merged HTML files are not included in PDF, printed manuals and MS Word RTF output.

Click to expand/collapsePreparing the external HTML files for merging

It is important to understand that the #MERGE command injects the entire external HTML file into the position in the topic where you insert the command. This means that it is advisable to remove everything in the external file outside the opening and closing <body> and </body> tags before merging.

The topic page already has its own header section and <body> tags, and if you don't remove this material from the external file you will have double header information. This may work, but it is not recommended because it can and will cause problems in some situations.

1.Open the external HTML file in an editor.

2.Locate the opening <body> tag and delete it and everything that comes before it.

3.Locate the closing </body> tag and delete it and everything that comes after it.

4.Save the file in the project folder with the .htm or .html extension.

Click to expand/collapseInserting the #MERGE command

1.In the Help & Manual editor click in the position in the topic where you want to insert the contents of the external HTML file. The topic can be empty but it does not have to be. The #MERGE command inserts the contents of the file into the current topic without deleting anything.

2.Select the BTN_Insert_HTML HTML Code Object tool in Write > Insert Object and type the following code in the editing window:

#MERGE filename.htm

This assumes that the HTML file is in the project directory (i.e. the directory containing your Help & Manual project). You must include the path to the file if it is stored somewhere else. However, the files you import must be installed on your local file system. You cannot import files from the Internet using http:// references with the #MERGE command.

See also:

Inserting plain HTML code