Table of Contents from headers.

P

prinkster

Hello, I had a question about generating a table of contents from some
text in headers from different sections. Basically, I have a document
that is broken into several different sections, all with a "title"
that is typed in the header differently per section. I was wondering
if there is any way to generate a table of contents based on this
setup - I tried using a style in the header and generating a table of
contents that way, but it didn't work. If there is a setting or Macro
of some sort to do this, that would be great. Moving the title out of
the header is unfortunately not an option. Thanks a bunch.
 
J

John McGhie

There is, but it's a truly disgusting work-around :)

Headers cannot be included in the table of contents because they do not
exist on a particular "page", so Word cannot resolve a page number for them.

You really need to put the headings in the document and copy them into the
headers, not the other way around.

A) Type the heading and assign it the style Heading 1.
B) Now add a STYLEREF field in the header, and specify that it looks for the
most recent Heading 1 style.

The text of the heading will appear in the running header. And since the
Heading is now on a page, which has a page number, it can be included in a
normal table of contents.

To do it the other way around, you need to:
1) put a bookmark around the header, then
2) use a cross-reference to bring the text into the text of the document on
the page where you want it,
3) assign it a style to bring it into the Table of Contents, and
4) set the style to have white text that is only one point high, so the
reader will not see it in the text.

I told you it was ugly... Don't do it :)

Cheers

Hello, I had a question about generating a table of contents from some
text in headers from different sections. Basically, I have a document
that is broken into several different sections, all with a "title"
that is typed in the header differently per section. I was wondering
if there is any way to generate a table of contents based on this
setup - I tried using a style in the header and generating a table of
contents that way, but it didn't work. If there is a setting or Macro
of some sort to do this, that would be great. Moving the title out of
the header is unfortunately not an option. Thanks a bunch.

--
Don't wait for your answer, click here: http://www.word.mvps.org/

Please reply in the group. Please do NOT email me unless I ask you to.

John McGhie, Consultant Technical Writer
McGhie Information Engineering Pty Ltd
http://jgmcghie.fastmail.com.au/
Nhulunbuy, Northern Territory, Australia
+61 4 1209 1410, mailto:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top