If you have used Heading styles in your document, creating an automatic table of contents is easy. All subheadings should be labeled Heading 3, and so on. All major headings within your chapters should be labeled Heading 2. “Dedication” and “Acknowledgements”) in the style Heading 1.
If you want an automatic table of contents you need to label 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.
You cannot generate any automatic tables without first using styles effectively throughout your document.