Bizarre Table of Contents - How to Fix

Hello,
I have a Writer document. I only use 2 text styles in the document: Heading 1 and Default Style. I create a table of contents. I set the number of levels to 1. I expected that my TOC would be a list of those lines of text that had been assigned the Heading 1 style. Instead not only do I get Heading 1 but a total of 22 pages worth of assorted Default Style lines as entries as well. I can see no rhyme or reason behind why LO decides to make some regular lines of text into TOC entries and not others.

On this page Defining Index or Table of Contents Entries - LibreOffice Help
there are some instructions but that changed nothing.
Also on that page is a link to an item Creating a Table of Contents located at Creating a Table of Contents - LibreOffice Help
but that page returns a database error

Bottom line: My question: How can I get LO to create a TOC that only indexes lines of text defined using the Heading 1 style?
This is version 4.1.6.2 of LibreOffice Writer on Windows 7
Thank you.

ROSt52 is right when commenting that understanding the principles and implications of LO concepts about Styles & Formatting is rather hard at the beginning.

LO is very very versatile when it comes to Outline & Numbering. You can enter ANY styled paragraph in a TOC. All you have to do is configure the feature in the “Outline & Numbering” tab of the style definition dialog. You find there a drop^down menu to give the TOC style attribute: from body text (= not in TOC), level 1 to level 10.

Maybe during your direct formatting, you indirectly activated this feature. I don(t know (I didn’t went through the doc) if there is key binding associated with it, but I already had surprises in the past when typing the wrong ctl-something for a combination that visually changed nothing on the screen, so that I could catch immediately my mis-typing.

ajlittoz - good points, particularly “Maybe during your direct formatting, you indirectly activated this feature” I did check a couple of lines to see if that was the case but it was not so indicated in the styles options dialog. I did note that a number of the lines included in the TOC were lines that contained html source code pasted in from an ascii file. Logically that should make no difference but who knows what is going on under the covers.

@ajlittoz, it is also worth noting that use of TAB to indent paragraph styles also affects the outline level, which can change what is included in the default TOC index (which is based on outline levels). I generally manually specify the styles to be included in a TOC (refer point 2 in my answer here).

All I can say is that LibreOffice Writer is r-e-t-a-r-d-e-d!

I tried many alternative solutions since posting my original question, including swapping styles for headings and text, etc. but none of it worked. I was still getting default text lines in my table of contents every time I inserted a TOC into my document.

Recalling that LO is challenged when it comes to pasting styles I selected the entire document, right clicked, and selected “Clear Direct Formatting” thus throwing out all the bolding, italicizing, font-resizing, etc. that I had done manually on text in my document.

I then inserted a table of contents and it came out picture-perfect - not one single line of body text showed up in the TOC.

So is this a solution? Certainly not because it came at the price of throwing out the manual text formatting I had done. But at least now I have a clean table of contents.

Now the question is this - why would clearing all direct formatting have any impact what so ever on how LO Writer goes about building a table of contents?

You certainly should be able to apply manual formatting to body text without it upsetting your ToC. On my systems I can and I am unable to reproduce the problems you are having, but I am using Linux and OSX and newer versions of LO (4.2.5.2 & 4.3.0.4). It might be worth trying an updated version of LO (even though 4.1.6.2 is still considered “fresh”) and/or submitting a formal bug report.

As @mikebibo mentioned OS, I am using XP and had in no LibO version starting from ~ 3.4 - 4.2.5.2 never such a problem. It is appears simple that Heading Style was directly format to look like a default paragraph style.

This will remain an unanswered question. I never encountered this problem with OpenOffice Writer (I’m a newbie to LO Writer). In hindsight the only think I can think of as a possible source of the problem (which still leaves it an LO Writer problem) is that some of the text I pasted in perhaps had unicode/extended ascii chars that were “invisible” in my text editors (Textpad, Notepad++). and that these had some unpredictable effect on Writer that was undone when I cleared all direct formatting.

I don’t have time this week but I could attempt to recreate the problem with two approaches: simply pasting a text block and then pasting-special the same text as unformatted text, then create the TOC and see what happens.

Well, well, well, I remember days when I was sure that the computer is doing things in the wrong way… at the end I had to apologize to the computer… also I never did.

If there is something, which I regard as very strong in Writer then it is the Styles & Formatting function. I agree it is a bit difficult to understand the function at the beginning but once understood, it is excellent. I read the manual (free of charge) several times, and played around a bit. My way of learning.

Recommendation

  • Set up all the styles you most need at the beginning
  • Use the styles function
  • Apply direct formatting only when needed

Have not too much frustration and always keep in mind that a computer only does what you tell him.

ROSt52 said: Make sure that you do not have any direct formatting in your document

My response: That is a serious LO Writer problem if, as you state, LO can not handle any direct formatting in a document. As you can see in the answer I posted that is exactly what I did to solve the problem. And note that none of the direct formatting had anything to do with the style’s Outline & Numbering definition - which is the only part of a style’s definition that has any relevance in this matter.

ROSt52 said: Go through your document and search for each line, which should be Heading 1 style, Place the cursor in these lines and double click on the paragraph Heading 1 style or ctrl+1

My response: That I had already done that should have been apparent from my original question.

ROSt52 said:. and always have a look into the manual.

My response: In this case as I indicated in my post the online help was of no use.

ROSt52 commented: always keep in mind that a computer only does what you tell him.

My response: except when the software in question is not functioning as advertised.

Having problem with ToC. Need to move around multiple documents quickly and ToC has been invaluable. Some of the documents have script within them that is causing ToC to not recognise headings, enabling multiple headings with no links, cannot be corrected through Alt M. Cannot find any graphic representation of the ToC to edit. Programmers plaything users nightmare. Thanks for any help.
G

Can you better describe your problem? If you expect help, give concrete examples of the bad behaviour you complain about.

where? is my answer?

I just had the same problem on windows version 4.1.2.3 , it gave me a 16 page table of contents including large swathes of text … quite a large document and when I started to go through each section of text and choose the dropdown option to remove ‘direct formatting’ then update the table of contents it was correct up to the point id removed the direct formatting in the document. Note: I was having to remove direct formatting for everything including plain text in a paragraph which had been incuded in the table of contents.
This was going to be very time consuming to go through the whole document removing direct formatting where it was messing up the table of contents … so I installed apache open-office and loaded up the doc, updated the table of contents and all was good!

The ultimate “mass-reformatting” weapon is quite simple: just select all (ctl+A) your entire document, then clear direct formatting. It will blindly remove every any formatting addition to the styles, whether intentional or not. Don’t save your document until you’re satisfied with the result, so that ou can revert the changes.

What worked for me :

Right-click on your TOC> Edit Index.

Then go to the “Style” tab, click on the Paragraph style that you want to remove from your TOC, in my case it was “Text Body”. Then click edit and set its Outline level to a high number, e.g : 8.

Go back to the main Tab “Type” of the Edit Index wizard, in “Create Index or Table of Contents”, set ‘Evaluate up to level’ to a level that is lower than the Outline level you picked.

Voilà

If you really want to remove it from TOC, set its outline level to Text Body. This “level” merely indicates the paragraph style does not contribute to TOC. It is better than setting it to a high level which could possibly become used some day (and you’d forgotten you’ve misused it as a “parking style”).