Fix the Document Map

contributed by Daiya Mitchell

Applies to all versions of MacWord; take me to the WinWord version

Are you seeing text in the Document Map that is not a heading, or random text in your Table of Contents? No worries—this page will fix your problem.

Why Problems Occur

The Document Map (View>Navigation Pane>Document Map) is a great feature that can make navigating a long document much easier. However, it can create some glitches.

The Document Map requires outline levels to function. When you switch into the Document Map, it applies outline Level 1 to things it thinks are headings—usually short, one line paragraphs—regardless of whether you already have headings in the document. The Document Map cannot operate without these outline levels, but it is supposed to suppress this behavior for documents that already use Heading styles. It doesn't—that's the bug. Since the Document Map depends on outline levels, and Tables of Contents usually use outline levels, you get random text showing up in the wrong place.

Preventing Problems

Option 1: On switching into the Document Map, look to see if a new AutoFormat has been added to the Undo list (the dropdown list from the Undo icon on the toolbar). That's the application of outline levels. Undo it. Remember to check for this every time, though it may not happen every time. In addition: Keep the Doc Map closed when opening a document. Word 2008 appears to have improved the behavior of the DocMap so that it is less likely to ruin a properly formatted document. However, if you keep the Document Map enabled so that it is automatically activated on opening a document, the Doc Map is still likely to add outline Level 1 to your document on opening and the Undo option will not be available.

Option 2: Don't use the Document Map—use Outline View instead. That's a bit drastic, but Outline View lets you do a lot more than simply navigate, if you follow the link to the article.

Fixing Problems

You have a few options here, depending on your needs and how comfortable you are with code:

Just Fix the Table of Contents

If the main problem is that your Table of Contents (TOC) has entries you don’t want, you can prevent the Table of Contents from picking up paragraphs that have been assigned outline levels as direct formatting. Simply press Opt-F9 to display field codes, or control-click the Table of Contents to Toggle Field Codes. In the TOC field, delete the \u switch. Press Opt-F9 to hide field codes, then control-click the TOC to Update the TOC field. [Thanks to MVP Stefan Blom for this fix.]

Just a Few Paragraphs Are Wrong

If only a few paragraphs are affected, you can use the ResetPara command on the affected paragraphs. ResetPara will remove all direct paragraph formatting and reset the paragraph to only style-based formatting (the Document Map adds outline Level 1 as direct formatting). ResetPara will not affect direct character formatting (bold, italic, etc)

You should be able to put the cursor in a misbehaving paragraph and hit Command-Option-Q, which is the default shortcut. If that keyboard shortcut does not work for you, you will need to dig the ResetPara command out of the Customize dialogs in order to access it. It may be easier to use the code in the next option.

The Whole Document Is Messed Up

If changing each paragraph individually is not feasible, you can use a small piece of code to reset the document automatically. The code will reset the outline level of every paragraph to the outline level that is set in the style. It does not affect any other formatting.

For Word 2008, MVP Paul Berkowitz has provided an AppleScript, which you can download by clicking here. (The script has not yet been tested in Word 2004, but might work.)

Double-click to open the script in Script Editor. Click Run in Script Editor—but first make sure your document is the frontmost document in Word, or preferably, close all other documents. Although this script is unlikely to do any harm, you may wish to test it on a copy of your document the first time. Allow several minutes for the script to run on your document.

For re-use, save the script into [username]/Documents/Microsoft User Data/Word Script Menu Items. Then you can run it directly from the script menu at any point.

For Word 2004 and earlier versions, you can use this macro provided by MVP Klaus Linke.

Sub ReSetOutline()

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

End Sub

If you don’t know what to do with this macro, see this article: "Install a Macro in MacWord"