Office Q&A: How to remove page numbers from a table of contents in a Word document

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.

  Table of contents two

Image: Ahlapot, Getty Images / iStockphoto

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.

Figure A

www.techrepublic

First, let's use the Reference tab to insert an index and see if we can turn off the page number:

  1. Place your cursor inside the document where you want it to be the TOC.
  2. Click on the References tab.
  3. 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.
  4. 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.
  5. Uncheck the option Show page numbers ( Figure D ). Before clicking OK, note that the preview now shows Title 4.
  6. 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.

Figure B

  q-ajuly2019-b.jpg "data-original =" https://tr3.cbsistatic.com/hub/i/r/2019/07/07/18a49c09-1cab-4630-a193 -a74b07bf499b / resize / 770x / 9474d84f9f705e871b85f0cb429f303e / q-ajuly2019-b.jpg

The default TOC does not include annotations (Heading 4 text).

Figure C

www.techrepublic

Figure D

www.techrepublic

Figure E

www.techrepublic

Without page numbers, the table of contents is not particularly useful. In fact, it is not obvious that is a a TOC. Before continuing, delete the TOC by right clicking anywhere within the TOC to select it. Then, press Delete twice.

Insert a field code

The References tab does not allow you to delete the page numbering of a specific level. The insertion of the TOC field code will have similar results.

To insert the field code manually, do the following:

  1. Place the cursor where you want the table of contents to be.
  2. Click on the Insert tab.
  3. In the Text group, click Quick Parts and choose Field from the resulting drop-down menu.
  4. In the list of Field Names, choose TOC. The Table of Contents button will show the same dialog used previously (when you added Title 4 and deactivated the page numbering option), but do not click on the button now.
  5. Click on OK to see the table of contents shown in Figure F .

Figure F

  q-ajuly2019-f.jpg "data-original =" https://tr3.cbsistatic.com/hub/i/r/2019/07/07/237ce858-9654-4983-bcae -3427a2f476c2 / resize / 770x / 46d30154cd7b5d0a8404edfaceba458c / q-ajuly2019-f.jpg

This table shows the page numbers.