Why is my "Table of Contents" deleting one line of the content that follows it each time I re-open the document?

Every time I re-open a document that has “Table of Contents” (aka TOC), the top line of content that comes after the TOC disappears into the bottom of the TOC. It is as if the TOC is a black hole that slowly deletes the content that is below it (from the top down, one line at a time) with each re-open of the document. So, every time I open the document, I have to make sure to re-enter the last deleted content (which is a pain in the ) and then click on “Update Index” to make the header reappear as an indexed item in the TOC. I take extra measures to prevent the header from being swallowed up on the next re-open by adding a couple empty lines between the table of contents and the first header. This is what my document looks like by default…

[Table of Contents]

[line #1 after TOC = this line will disappear/delete when I reopen the doc and, if it’s a header, then it will no longer be in the index of the TOC]

[line #2 after TOC]

[line #3 after TOC]

So, imagining that the section above is my document, line #1 will disappear/delete when I reopen the document. If I save and reopen again, then line #2 will also be gone/deleted and the TOC will no longer have line #1 nor #2 in its index, so I know those lines are gone. If I reopen the document enough times, then all content in the entire document will be swallowed up into the TOC and the TOC will also reflect the last state of content, so the TOC is also eating away at itself.

The TOC is supposed to outline the content that follows it, but instead it is a black hole that swallows one line of content each time the document opens.

My OS is Ubuntu 18.04.5 LTS
My LO is Version: Build ID: 1:6.0.7-0ubuntu0.18.04.10
The file is originally in DOCX format (attached).
I copied/pasted the contents into a new document, but the problem continues.
I saved the old and new document in ODT format.

Here is a screenshot of one of the Headers getting swallowed up, with my annotation in red…

Edit your question (don’t use an answer which is reserved for solutions) to add your OS name, LO version and document save format (.doc(x) or .odt).

Better, attach a short sample file with the issue. For that, when editing the question, use the paperclip tool.

ajlittoz is right, a sample is needed. I could not reproduce this behaviour even using foreign formats and bad practice. The nearest I got was to put the TOC in a frame with “Wrap Through in Background” set but that only hid text, not deleted it, and it was easy to fix by changing Wrap option. Cheers, Al

It might be best to copy everything except the TOC into a new document then create a new TOC. With a bit of luck, the problem will not arise one the new document.

Hi @ajlittoz and @EarnestAl. Thank your for your recommendations, I followed them. Will you please review my revised post?

I see the effect you describe when opening your file, but it is not repeated when I save and reopen, so I suspect that it is a bug in docx support in version 6.0. My tests were made running v. on Windows 10.

Tried opening the same file in Word and OpenOffice Writer, which displayed the same effect, but neither would repeat the error. In OpenOffice the ToC was refreshed immediately, removing the “devoured heading”.

I also see that the ToC entries are set up with double layers of hyperlink (two link start first, and two link end last). Not sure whether this is a cause, consequence, or just a random detail.

Possible solutions:

  • Remove the ToC and insert a new one. Save the file as ODT.
  • Update the LibreOffice suite
    may not be available for your OS version from Ubuntu software repositories.
    You can add LibreOffice repositories in Ubuntu-Synaptic.

I see the same as keme, I can’t get it to “eat” anything more on my installation.

When in Linux Mint Cinnamon 19.3 I use Flatpack LO which keeps it updated to the latest version (currently even though the official Mint Linux version for LO was in the low 6’s. The newer files mean that I cannot easily update the Mint version except by new install so that is a drawback. Cheers, Al

I ran into the same thing as described here. It will only “eat” the next line if you update the index and then save the document. The next time you open the document the next line will be considered part of the index and when you update it that line will disappear. Following this recommendation, I updated to since my Ubuntu 18.04-provided version was version 6.0.x.y (sorry, didn’t write the exact version down), and that successfully fixed the issue for me.

Strangely, I get different behaviour in 4.x and Writer. In 4.x, when you open the file, what is displayed is what you get in after refreshing the TOC.

I then saved your document as .fodt to be able to analyse its structure. From this analysis:

  • The “Exams” paragraph is not part of the text but a component of the TOC. It may have been restyled as Heading 1 manually.
  • The initial TOC (displayed after load) is not the current TOC but the cached state of some earlier version of the document (e.g. the “PACE” part has no corresponding data in the text body.

When you refresh the TOC, Writer scans the document excluding the present TOC, therefore skipping the “Exams” paragraph and rebuild the TOC with the Heading n present in the body, i.e. “AHC”, “AP” (both Heading 2) and the last blank paragraph (Heading 1).

The TOC doesn’t “swallow” your “Exams” paragraph. Someone (user or M$ Word?) erroneously put it into the TOC, messing up the document structure.

I can’t reproduce the swallowing effect. When I add a Heading 1 after the TOC, it stays there when I reopen the TOC and a refresh does not delete it.

Maybe, you’ve disabled Protected against manual changes in right-click on TOC and Edit Index, Type tab. In this case, if you click at end of the last line in the TOC, Return and type a heading, this heading is made part of the TOC and will be wiped out at next refresh.

To avoid this, make sure your TOC is read-only.

I would qualify your problem “user-error” as non-TOC data has been typed inside the TOC.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.