TOC and styles

W

Word user

When I create a TOC using Insert, Reference in the
toolbar, the TOC contains 3 headings that aren't styled as
Heading 1, 2, 3 etc. I am wondering why it is including
these, as their style is normal.

Thanks!!
 
D

Dayo Mitchell

Have you been using the Document Map on this doc?

If you have:
When you switch into the document map, it applies outline levels to things
it thinks are headings (short, one line paras, usually), regardless of
whether you already have headings. It been reported in Win & Mac versions
of Word from 97 to 2004, and it's a bug, or a badly-designed feature if you
are in a charitable mood. Suggested workarounds and a couple aids if Doc
Map just ruined your careful formatting:

Don't use the Document Map, use Outline View instead:
http://www.mvps.org/word/FAQs/Formatting/UsingOLView.htm

On switching into the Doc Map, look to see if a new AutoFormat has been
added to the Undo list. That's the application of outline levels. Undo it.
Remember to check for this every time, though it may not happen every time
(this workaround has only been tested on a Mac, and not thoroughly).

After the fact fixes:

Use the ResetPara command on the affected paragraphs to remove all direct
paragraph formatting and reset the para to only style-based formatting (the
doc map adds outline levels as direct formatting). ResetPara will not
affect direct character formatting (bold, etc) and the usual keyboard
shortcut is control-q (cmd-opt-q on a Mac).

Run this handy macro once posted by MVP Klaus Linke that resets the outline
level of every paragraph to the outline level that is set in the style.

Dim myPara As Paragraph
For Each myPara In ActiveDocument.Paragraphs
myPara.OutlineLevel = _
myPara.style.ParagraphFormat.OutlineLevel
Next myPara

If necessary, see:
What do I do with macros sent to me by other newsgroup readers to help me
out?
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
(Mac: http://word.mvps.org/MacWordNew/InstallMacroMac.htm)

Hope that helps,
DM
 
D

Dayo Mitchell

PS. Sorry, forgot to mention the necessary piece of information that the
TOC picks up text formatted with outline levels.
 
S

Stefan Blom

Also note that it is quite possible to prevent the table of contents
from picking up paragraphs that have been assigned outline levels as
direct formatting: Simply press ALT+F9 to display field codes. For the
TOC field, delete the \u switch and then press F9 to update the TOC.
 
D

Dayo Mitchell

Much simpler than any of my solutions! Thanks, Stefan, saved the tip. The
things I don't know about field codes are legion...
 
R

Robert M. Franz

Hi Dayo

Dayo said:
Much simpler than any of my solutions! Thanks, Stefan, saved the tip. The
things I don't know about field codes are legion...

Simpler, yes, but there's much in favour of making sure there are no
paragraphs with a wrong outline level in contrast to making sure the TOC
picks up only "Headings", IMHO (unles there's a good reason why these
paragraphs have an outline level <> bodytext, of course).

2cents
..bob
 
D

Dayo Mitchell

Hi Dayo



Simpler, yes, but there's much in favour of making sure there are no
paragraphs with a wrong outline level in contrast to making sure the TOC
picks up only "Headings", IMHO (unles there's a good reason why these
paragraphs have an outline level <> bodytext, of course).
Oh, absolutely. Much better to have a properly formatted doc. But as a
"quick fix for today"-level tip, it's a good one. And equally educational
in a different direction, leading people to know more about how the TOC
field operates.

Dayo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top