Problem with headings in ToC

I create Table of Content using Writer automatic tool, but complete first page is included in Table of Content although its style is Text Body (not Heading 1, Heading 2 etc…)

File example is here FILE EXAMPLE

I managed to solved problem by cutting the first page, generating table of content and then inserting page back… but I would like to know why is this happening.

Examining the XML there appear to be bookmark entries against all the text entries on the initial page e.g.,

<text:h text:style-name="P17" text:outline-level="1">
    <text:bookmark-start text:name="__RefHeading__1561_42739795"/>
        KORPORATIVNA STRATEGIJA
    <text:bookmark-end text:name="__RefHeading__1561_42739795"/>
</text:h>

How this has come about I cannot determine. Perhaps via the use of direct formatting, as there are many direct format styles in use, or it may be related to how the ToC was initially inserted. There certainly do not appear to be any visible bookmarks available when attempting to insert a cross-reference. These bookmarks are being picked up by the ToC. To fix the ToC problem (and leave the bookmarks):

  1. Right-click on the Table of Contents (ToC) > Edit Index/Table…
  2. On the Index/Table tab under the Create from section de-select Outline and select Additional Styles; Click the ellipsis (…) button beside this last option.
  3. On the Assign Styles dialog set the Heading 1 style to level 1 and Heading 2 style to level 2; Click OK.
  4. Click OK.

To fix the bookmarks and the ToC:

  1. Highlight all content prior to the ToC.
  2. From the Apply Style pull-down menu select “Clear Formatting”.
  3. Save the file under a new name.
  4. Close Writer.
  5. Re-open the file.
  6. Right-click on the Table of Contents (ToC) > Update Index/Table…
  7. Re-style the front page content as required (preferably using paragraph styles).

thanks… now it works… however, any idea why is this happening?

I will update my answer to provide a clearer analysis.

thanks… both approaches are good, and problem is solved…

Thanks, had the same problem at the end of a document and solution 2 worked. Only I didn’t even have to resave the doc.

Yes, worked for me too. Thanks so much.