If you have used Heading styles in your document, creating an automatic table of contents is easy.
All subheadings should use Heading 3, and so on. All major headings within your chapters should be use the Heading 2 style. If you want an automatic table of contents you need apply the Heading 1 style to all of your chapter titles and front matter headings (e.g. Microsoft Word can scan your document and find everything in the Heading 1 style and put that on the first level of your table of contents, put any Heading 2’s on the second level of your table of contents, and so on. An automatic Table of Contents uses Styles to keep track of page numbers and section titles for you automatically.