Using StyleRef field to use H3 if no H2 in document

S

Susan

I inherited a lot of documents with multiple chapters. The
template has a header with a field that prints the
H2heading in the header. The problem I would like to solve
happens when a chapter is so small that it does not have
an H2 heading. What happens now is that the previous H2
heading prints (but the H2 heading is from the previous
chapter).

Is there a way to create a field that says something like:
Print the H2 heading, but if there is no H2 heading in
this section, just print the H1 heading.

If I could solve this problem, it would eliminate many
hours of having to adjust this field by hand.

Thanks.
 
R

Robert M. Franz (RMF)

Hi Susan,
I inherited a lot of documents with multiple chapters. The
template has a header with a field that prints the
H2heading in the header. The problem I would like to solve
happens when a chapter is so small that it does not have
an H2 heading. What happens now is that the previous H2
heading prints (but the H2 heading is from the previous
chapter).

Is there a way to create a field that says something like:
Print the H2 heading, but if there is no H2 heading in
this section, just print the H1 heading.

I've been in a similar situation and have found a solution that was
workable for me. Preconditions are: the Headings level 1 and 2 are
numbered (by Word) and that the very first chapter does have a H2. Then
it is only a matter of juggling with IF- and mainly STYLEREF-fields.

In the header, you want to insert an IF field an compare the number of
[n()] the current H2 with the number of the current H1. If n(H2^)<n(H1),
then there's no current H2 (so far) in this chapter; you then insert a
STYLEREF pointing to H1. Else [ergo: n(H2)>=n(H1)] a STYLEREF pointing
to H2 will do.

You'll find out all you got to know about the fields in Word's online
help, take heed to the styleref field-switches.

Greetinx
..bob
...Word-MVP
 

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