TE Edit Control Java / HTML-JavaScript Help
Product page

TerInsertToc

Insert table of contents.

boolean TerInsertToc( repaint)
boolean repaint;Repaint the window after this operation

Description: This function scans the document to build a table of contents at the current cursor location. It includes a text line in the table of contents if it uses a paragraph style and the name of the paragraph style is in the form of 'heading n', when 'n' is a number from 1 to 9. The heading number is used to specify the indentation level. This function uses paragraph styles 'toc n' for the assembled heading lines. The top level heading (heading 1) is assigned the style 'toc 1', and so on. The editor would automatically create any missing 'toc' style.

To insert a table of contents, first create the heading styles using the TerEditStyle function. For example, if you wish to insert a three level deep table of contents, create heading styles 'heading 1', 'heading 2', and 'heading 3'. Then place the cursor at the heading lines and apply a suitable heading style using the TerSelectParaStyle function. The last step would be to position the cursor where you wish to insert the table of contents and call the TerInsertToc function.

The table of contents are automatically updated whenever repagination occurs.

Return Value: This function returns true when successful.