These are the steps you should take to generate a "table of contents" automatically:
Highlight the top heading
Styles -> Heading 1
Highlight the sub-heading
Styles -> Heading 2
Click on where you want the table of contents to be
Document Elements -> Automatic Table of Contents -> Click
The table of contents is updated using: Right Click -> Update Field -> Update Entire Table
To have a numbered table: Paragraph -> Multi level list