Include table of contents file

When outputting HTML by splitting it, the "-tocout" option is used to output the table of contents created by Word's table of contents function as separate HTML files. This is an example of how to load this HTML file (toc-inc.html) into each of the split HTML files using JavaScript.



Conditions of use

  • Word document has headings or paragraphs that specify outline levels 1-3.

  • Word document has a table of contents created with Word's Table of Contents feature.

  • Split and output HTML.

  • Use jquery. * jquery is a JavaScript library that makes JavaScript easier to write.

Commands to use




-split [n]

Split HTML output separated by headings or paragraphs with specified outline levels 1-3 in a Word document.

The [n] following the space specifies outline level 1-3.

Split output at the specified outline level.

All upper outline levels are also split.


When HTML is output in separate HTML files, the table of contents created by the Word table of contents function is output as a separate HMTL file (toc-inc.html).



Specify the JavaScript to be used. Specify "-js" followed by a space and the URL or path of the js file.



JavaScript to use

  1. Use jquery. Specify the following URL following the "-js" command, or download the js file, save it in a location that can be referenced from the HTML file, and specify the path to the location.
  2. Create a js file containing the following JavaScript, save it in a location that can be referenced from the HTML file, and specify the path to that location. (In the following command example, the file is saved as "inc-toc.js" in the same folder as the HTML to be output.)






Command example

Example of converting "sample01.docx" in the "sample" folder on the desktop to HTML.

Word2HTML.exe %USERPROFILE%\Desktop\sample\sample01.docx %USERPROFILE%\Desktop\sample\sample01.html -js -js inc-toc.js -split 1 -tocout


* This JavaScript will not work on your local PC; you must either upload it to a web server and access it from a web browser, or configure your web browser if you wish to run it on your local PC.