You can use the built-in options to build a simple table of contents, but very often, you'll need to change the underlying field code to get the results you want.
Word's Table of Contents (TOC) feature is powerful and flexible, but getting the results you need is not always possible using its built-in options. Often, you must modify the underlying field code to obtain certain results. That is what Giovanni came across. You want to delete page numbers from an annotation. Fortunately, the solution is simple, if you know how to modify the underlying field code of the TOC.
A field code is a set of instructions that you can modify: intelligent text of a type. The results are not literal text, but the field code shows text. You can customize a field code by adding switches . Often, a change is the only way to make certain customizations. The switches are simply more instructions.
I'm using Office 365 on a 64-bit Windows 10 system, but this solution will work in earlier versions. However, it is not compatible with the browser version, although you can update an existing TOC. You can work with any document or download the .docx and .doc demo files.
LEARN MORE: Office 365 Prices and features for the consumer
Basics of the TOC
Word offers two ways to insert a TOC:
- Use of the Table of Contents option in The References tab offers a gallery with few predefined TOC and access to customization options.
- The use of Quick Pieces on the Insert tab allows you to enter the underlying field code of the TDC manually.
Both offer options that allow you to customize all levels of your TDC. However, none of the options allows you to omit page numbers of a specific level . However, you can remove all page numbering, which is something you probably do not want to do often.
Use the Reference tab
If you plan ahead, you may know that you want to omit the page numbers and create the corresponding TDC, for the most part. For example, the simple document shown in Figure A needs a TOC. We have already applied Title 1 to the text of the section and Title 4 to the text of the annotation. (The use of integrated styles is not strictly necessary to create a table of contents, but it is the easiest way). We do not want the page numbers in the annotations to be shown; Currently, we only have two levels: Title 1 and Title 4.
First, let's use the Reference tab to insert an index and see if we can turn off the page number:
- Place your cursor inside the document where you want it to be the TOC.
- Click on the References tab.
- In the Table of Contents group, click Table of Contents and choose Custom Table of Contents from the drop-down menu. Note that the Print Preview screen ( Figure B ) does not show Title 4 (the style we use for annotations). The default function is three levels, Title 1, Title 2, and Title 3.
- To add annotations to the table of contents, click Options. In the resulting dialog box, enter 4 in the TOC level control to the right of Title 4 ( Figure C ), and click OK. You might consider eliminating levels 2 and 3 because Heading 2 and Heading 3 are in use, but I recommend that you do not. You can add them later, and when the TOC does not update to show those levels, you may not remember why.
- Uncheck the option Show page numbers ( Figure D ). Before clicking OK, note that the preview now shows Title 4.
- Click OK to return to the document. Figure E shows the resulting TOC. All the page numbers have disappeared, but we want to delete the page number only for the annotation level.