The best way to generate a table of contents is to apply the predefined heading paragraph styles, such as "Heading 1", to the paragraphs that you want to include in your table of contents. After you apply these styles, you can then create a table of contents.
Click in your document where you want to create the table of contents.
Choose Insert - Table of Contents and Index - Table of Contents, Index or Bibliography, and then click the Type tab.
Select "Table of Contents" in the Type box.
Select any options that you want.
If you want to use a different paragraph style as a table of contents entry, select thecheck box in the area, and then click the button next to the check box. In the dialog, click the style in the list, and then click the index level for the selected style.
LibreOffice creates the table of contents entries based on the outline level of the paragraph style and the paragraph contents. If the paragraph is empty, it will not be included in the table of contents. To force the empty paragraph to be listed in the table of contents, manually add a space or a non breaking space to the paragraph. Spaces added in the After text box of the Numbering tab in the Heading Numbering dialog will not work for this purpose, since they are part of the paragraph numbering, not the paragraph contents.
Do one of the following:
Right-click in the table of contents and choose Update Index or Table of Contents.
Choose Tools - Update - All Indexes and Tables.