Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to produce a table of contents looking like this :

Heading 1 ........................................... p. 1
    Subheading 1 -- p. 1, Subheading 2 -- p. 3, Subheading 3 -- p. 4,
    Subheading 4 -- p. 4, Subheading 5 -- p. 6
Heading 2 ........................................... p. 7
    Subheading 1 -- p. 7, Subheading 2 -- p. 8, Subheading 3 -- p. 8,
    Subheading 4 -- p. 10, Subheading 5 -- p. 11
Heading 3 .......................................... p. 12

And so on, in Word 2007.

Any ideas how I could achieve this? My current toc is generated using {TOC \o "1-3" \h \z \u}. I imagine the \p switch would work, assuming that I could restrict it to level-2 headings.

share|improve this question
up vote 1 down vote accepted

I'm afraid you can't do anything like this. You would quickly run into the limitation that a TOC in Word inserts each entry as a separate paragraph, so that would make the second level of the TOC almost impossible to construct.

The only way to achieve this would be to create a macro which generates such a TOC for you. In other words when it's run it would iterate through each heading paragraph in the document and insert a TOC like you want for you.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .