Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Word 2010 I want text (eg. VIS - 1, VIS - 2, VIS - 3, etc.) to show in front of the page number in the Table of Contents. I prefer to include the text (e.g. VIS) in the footer in front of the page number.

share|improve this question

2 Answers 2

There is perhaps one way to achieve this, but it is a work around and is a bit complex to setup (however easy to use). It involves adding the prefix to each heading in the document as hidden text and formatting the TOC styles in a special way.

To setup the TOC and styles:

  1. Scroll up to your table of contents and press ALT+F9 to show the field code. You should see something like { TOC \h \z \u }. Add a \w switch to the field so it looks like { TOC \h \z \u \w }. Press ALT+F9 to display field results again.
  2. Right click on the TOC and choose Edit Field. Click the Table of Contents button.
  3. Click the Modify button down the bottom right and make sure TOC 1 is selected in the styles list. Click the Modify button.
  4. In the new dialog click the Format drop down button and select Tabs
  5. Now here's where the magic happens. Add two tabs. The first right aligned with ". . ." leaders at just before the edge of the page (e.g 14.5cm on a portrait A4 page). Click Set.
  6. Add another tab right aligned with no leader (None) at the edge of the page e.g 15cm.
  7. With the two tabs set press Ok to all dialogs open to return to the document.
  8. Apply the same changes for the other TOC levels used in the document by going through Step 6 - Step 11 again but doing it for the other styles in the list i.e TOC 2 - TOC 9. If in doubt do it for all of the styles in the list.

To add the prefix to each entry:

  1. For each paragraph that will appear in the TOC click the cursor the end of the line and press Tab and then type your prefix.
  2. Select the text you just wrote, highlight both the space that the tab character and the prefix.
  3. Go to Font -> Color and change the color of the text to match the background (e.g white on a white document background). The prefix should be hidden and the heading should now look normal again.

  4. Once this is done for all paragraphs right click on the TOC and choose Update Fields. Now each page number should have it's own prefix as shown in the image below.

Here is the sample output below. The first heading in blue shows the tab and prefix before hiding the text. The second heading shows the final output where the text is hidden. enter image description here

An advantage of this method is you can choose any prefix you want and can also have separate prefixes for each entry if desired. Another bonus is if a heading does not contain any prefix, the TOC still looks pretty normal, the page number only appears a bit in from the edge of the page.

The trick to this work around is the \w switch instructs the TOC to include the tab found in the heading in the generated TOC entry. This first tab character aligns the dots to the first ruler tab that was set in Step 8 and is followed directly by the prefix. The next tab character is automatically added by MS Word when generating the TOC and aligns the page numbers to the edge of the page.

share|improve this answer

There's no way to have the table of contents automatically insert a prefix of your choosing before the page number. It's just not a supported feature.

However, you can insert chapter numbers. This may not be what you wanted since you gave an example of "VIS" which is not a number. But this mvps article describes how to do that: http://word.mvps.org/faqs/numbering/chapternumber.htm

For now, what you can do is edit the table of contents manually (treat it like it's regular text in a document and just type in it) and add in your desired prefix. But when you go to regenerate the TOC table, it will wipe out your changes. It's kind of unfortunate but I found a post by an MVP who said there's no way to enter your own text there, so I tend to believe them (especially considering I've been using Word in various releases for over a decade and have never seen this behavior in practice.)

See Stefan Blom's reply here for more.

If this is very important to your workflow and the issue isn't going to go away any time soon, you could probably do something with a Visual Basic macro that would go into the table of contents and manually edit the text to add that "VIS-" prefix as you want. If you decide you want to go that way, I'd ask on stackoverflow about how to write a macro to do that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.