Sunday, February 10, 2008

Table of Contents in Word 2007 sucks!

The Table of Contents feature in Word 2007 is seriously broken. Sometimes the entries for figures have different fonts, which makes the toc look like a ransom letter. I had to go to a correct figure caption and then copy-and-paste it into the incorrect captions to make all the entries consistent. What's most annoying is that the incorrect entries effectively ignore the style setting specified in "Insert Table of Contents..." -> Formats="From Template" -> "Modify..."

Worse, I'll save my document and then reopen it, and a bunch of seemingly random lines from the cover page, other parts of the document, etc. suddenly appear in the Document Map and TOC. For some unknown reason, the Outline Level for these lines is set to "Level 1." After I change the Outline Level for all the lines to "Body Text," everything looks fine. However, if I change the Outline Level for the "Table of Contents" line to "Body Text," and save and then reopen, all the lines are set back to Level 1 and show up in the TOC again!

Workaround
The field code for my TOC is

{TOC \o "1-3" \h \z}

This pulls in all headers at outline level 1-3 and all other text with Outline Level 1-3. To pull in things like "List of Figures" and "Bibliography" I create a new style and set the Outline Level to 1. Make sure the text "Table of Contents" that immediately preceeds the actual TOC is not a heading style.

I hope this helps! If anyone has a better solution, please leave a comment!

20 comments:

Unknown said...

Marc - Try using different styles on the text you do not want to have appear in the TOC. For Example, apply "Heading 1" style to all of the text that goes in to the TOC, and "Title" to those that do not. Make sure that "Title" style is set with an outline level of "Body" and your problem should resolve. Word TOCs were always designed to capitalize on Styles, however they have never been so pronounced as they are now. Good luck!

Marc Eaddy said...

This doesn't help. I'm seeing what looks like a bug. I open my document and do nothing but change the text "Table of Contents," which appears immediately before the TOC, to "Title" style, then save, close, and reopen the document. During opening Word displays "Word is formatting the document" in the status bar and, lo and behold, a bunch of random lines have now become Outline Level=Level 1 and appear in the TOC. Note: Prior to saving these lines were "Title" style with Outline Level=Body Text. During opening ("Word is formatting...") they are converted to Outline Level=Level 1.

Unknown said...

Maybe you have the document set to "Automatically update document styles" which essentially undoes all of the formatting changes by "restoring" the styles from the template every time it is opened. I know we have made that challenge for ourselves here many times!

Marc Eaddy said...

That is possible, but I couldn't find the "Automatically update document styles" option you referred to. If I right-click a style and click "Modify..." I see a checkbox for "Automatically update," but it is unchecked.

Regardless, I don't think that's the problem, since I've made changes to styles that keep even after I reopen the document. The problem is that the Outline Level gets changed to Level 1, regardless of whether the style says Body Text or I saved it as Body Text. Using the Normal or Title styles doesn't help.

Shervin Emami said...

I have EXACTLY the same problem, and I'm sure its a bug in Word 2007. A work-around is to "Select All", then right-click somewhere and click "Paragraph", then set the "Outline level" to "Body Text". It seems to fix everything in my thesis, but I have to do this workaround each time I open the file! If you find out how to fix this problem, can you please email me at emami at itee dot uq dot edu dot au. Cheers.

WisTex said...

What if you actually WANT the Title in the table of contents? Unless there is a way to do that, I now have to change Heading 1 to look like the Title, Heading 2 to look like Heading 1, Heading 2 to look like Heading 3, etc. A major pain in the butt if you ask me.

David Kislingbury said...

Did anyone come up with a solution to this as I am having exactly the same problem here, so frustrating.

Marc Eaddy said...
This comment has been removed by the author.
Ms. J said...

If you don't want to include the Title, then check the formatting of the Title. If you started with a Heading and changed it afterwards, it will still have 'Heading' as the Outline level.
Go to Modify Style, click the Format button at the bottom, and then click Paragraph. Under General, make sure Body Text is selected at the Outline level.

Unknown said...

You can try "clear formatting" to those that you do not want it to appear in TOC.

Anonymous said...

Hi guys,
Well, this problem has driven me nuts all day - 8 hours wasted on this. I have to say thank you to Shervin for the workaround - at least that took the pressure off my deadline :-)

Guys, I noticed that I had this problem on 2 PCs with Word 2007 SP2installed but not on a third machine (actually a W2K8 Terminal Server, but that is irrelevant). When I opened my doc on the 2 PCs they would both mangle the ToC when I regenrated it. Word 2007 installed on the third machine (server) did not, so I concluded the problem was specific to the 2 PCs not to the document or to Word itself (Microsoft have had plenty of time to fix this if it was a bug). So I tried 'resetting' my Word installation, which you can do by renaming 2 templat files and deleting one registry key (take care). here's a link with the procedure:

http://word.tips.net/Pages/T001330_Factory_Default_Settings_for_Word.html

This was enough to fix the problem on both PCs for me - now the doc is fine when I regen the ToC. I think my styles had possibly become screwy.

Here's the kicker - the problem first appeared for me after I converted my document to PDF using PrimoPDF. PrimoPDF was installed on both PCs but not on the server. I cannot say this was the culprit for certain, but I have since uninstalled it.

Good luck all. You can get me on email at garry_williams *AT* msn *DOT* com.

Enrico M. Crisostomo said...

I'm experiencing this problem in just one PC. That's pretty frustrating, indeed, because once a file it's broken the bug will show up in the other PCs, too.

I noticed that it only happens when I open some file leaving the Document map feature on. If I close it before closing the document, the table of contects doesn't get screwed up.

Hope this helps,
Grey

Unknown said...

For those of you cant figure out what is causing the problem (I for one cant, the problem just seems to pop up randomly when my documents get really large and complicated) I have a little fix.

The problem is that when you close your doc everything is fine, when you open it again for some reason words has to "format the document". When you see that little note pop up down the bottom of word (where "word is opening the file" also sits) hit escape. This will cancel the formatting that is being applied. This stops word screwing with your doc.

I agree with OP, this is a bug.

hope this helps.

Anonymous said...

Hi all,
A colleague at work came up with a great workaround to this problem for me: highlight your ToC and choose Edit Field. Choose ToC then click the Table of Contents button. Click the Options button and then *Untick* Outline Levels.

This fixed it for me.

Cheers,
Garry

Unknown said...

Hi All,

I have had the same problem and following Marc's solution I looked into the code beneath the table of contents and it was: {TOC \o "1-3" \h \z \u}. I have removed \u and since then it works fine.

Cheers,
Paulo

Kim Stovall said...

I removed the table of contents, right-clicked where the table of contents should be, then selected Toggle Field Codes. I modified the field code from {TOC \o "1-3" \h \z \u} to {TOC \o "1-3" \h \z}. Then I selected Update Field. It fixed the issue. Thanks for the work around!

naomi said...

Hi does anybody know if I can create a table of contents in a side bar along the left side of my document so it is always visable so I can jump to sections in the doc very easily rathern than have to scroll up to the top of the doc each time I need to use it? I'm trying to create a doc for client notes and I need to find any one of 50 clients very quickly so I can record straight onto the computer instead of having to handwrite. many thanks Naomi

GW999 said...

Hi Naomi,
I'm using Word 2010 and to allow me to navigate the document very easily I turn on the Navigation Pane. Click on the View tab in the ribbon menu and then enable the Navigation Pane option. This then allows you to click on a heading in the document to jump straight to it. From memory I think the same thing was possible in Word 2007 but it was just called something else.

HTH,
Garry

lorrwill said...

Looks like we have the exact same bug at work. So glad I found this.

Thanks for posting it. Microsoft has been ZERO help. (No surprise there!)

Jesse Springfield said...

I followed Word 2007 directions to create my TOC, watched Youtube Videos on it, looked easy.

I ONLY Hilited 10 chap Headings as Heading 1. Went to a blank pg, went to Reference tab, then TOC box, clicked Insert TOC, POW!
5 pages of everything in the book pasted in = HELP!?
(even portions of paragraphs 150 pgs into the book where I NEVER Hilited)

I can't get rid of all this junk out of the 'memory' of the TOC now. Everytime I try to update the TOC, POW! throws it all back in again. I've wasted 3 days now surfing the Web, typing comments & emails to people. Still praying & hoping someone can send me a fix.

Thanks for a minute, Josh in Orlando, FL.
hollidayjosh33@gmail.com