Get a Free Trial

Including a Table Of Contents in a DOCX document

GrabzIt can add a table of contents to a Word document by using the special grabzittoc HTML element. To add a table of contents to a PDF document you need to use the outline feature.

To generate the table of contents GrabzIt inserts a standard DOCX table of contents control, which has an entry for every one to three headers contained in the document.

The table of contents will appear wherever the grabzittoc element is placed. To assign the table of contents a title set the title attribute, by default the title is empty.

<grabzittoc title="Table of Contents"/><grabzittoc>

To use higher levels of headers in the contents use the maxLevels attribute. Otherwise, the max levels will default to three.

<grabzittoc title="Table of Contents" maxLevels="4"/><grabzittoc>

Note that the contents will be generated by Word the first time the document is opened and so it will ask a user if you want to update the fields. Answer yes to properly render the table of contents.

There is also similar table of contents functionality available in PDF via PDF outlines.