If you want the ultimate control, use field codes, sets of instructions that contain a field name and switches. After you enter your options, Word creates the field codes, which it then uses to build your table of contents.
Want more?
So what exactly happens when you enter your options in the Table of Contents dialog box?
To find out, let’s go behind the scenes. Click the Table of Contents and press Alt + F9.
At the heart of your automatic table of contents is this – field codes.
After you enter your options, Word creates field codes, which it then uses to build your table of contents.
Field codes are nothing more than a set of instructions containing a field name and switches.
The field name TOC instructs Word to build a table of contents, and the switches tell Word how you want it built.
For example, this O switch tells Word to include outline styles 1 through 3,
which are mapped to heading styles 1 through 3, respectively.
The H switch adds hyperlinks.
And the T switch lists the other styles you want to include,
which in this case is the Summary style we added in the last movie.
Check out the course summary for a link to the full list of fields and switches.
By the way, Word is full of field codes that you may not even know about, such as this one for page numbers.
But we won’t go into all those here.
After you generate field codes with a dialog box like Table of Contents, you can click in it and edit the code directly.
This can be a lot faster sometimes than dealing with a dialog boxes.
Also, you often have more options available with the direct approach. I’ll show you.
Press Alt + F9 to show the table of contents again. Let’s say we want to remove the page numbers from our descriptions.
In the dialog box we can remove all page numbers, but not from individual TOC levels. However, we can with field codes.
Press Alt + F9 again. Click just ahead of the T switch and type the switch backslash n, and a space.
Then, type 4 dash 4, and a space. This switch tells Word to suppress page numbers for TOC level 4.
We need to type 4 dash 4 because Word requires that the number be entered as a range,
so page numbers will be suppressed for levels 4 through 4.
Right-click the field code and click Update Field and Update entire table.
Now press Al t+ F9 and you’ll see that the page number is gone from the description.
So TOC is the field name used to create a table of contents.
But for customizing what goes into a table of contents there’s another field that’s just as useful –TC.
Up next, we’ll use TC to add custom entries to the table of contents.