STYLEREF picks up only the first style

M

MJK

I have a document that has headings in it, each marked with the appropriate style. I'm looking for a way to have the page headers reflect the text of the previous "Heading 1" paragraph, or, if there's a "Heading 1" paragraph on the page, the text of the first such paragraph. In other words, I'm looking for something that behaves the way that STYLEREF is documented as behaving.

I've tried using {STYLEREF "Heading 1" \* CHARFORMAT} in the page header for odd-numbered pages.

On page 1, this works perfectly and shows the correct text.
On page 2, there is a Heading 1 paragraph.
On page 3, the page header shows the original text (as in page 1) and ignores the text of the Heading 1 paragraph on page 2.

In fact the odd-numbered page headers show identical text throughout the document and ignore all "Heading 1" paragraphs except the first one.

As an experiment I tried inserting a (continuous) section break in the middle of the document: the odd-numbered page headers after that point reflected the last "Heading 1" paragraph *before* the section break.

Is it really necessary to insert a section break after every occurrence of one's chosen style, if one wants STYLEREF to work properly?

I'm using Word 2000.
 
C

Charles Kenyon

StyleRef works the way it is documented (for me in Word 97-2003). I use it
extensively. I don't use different odd and even that often. I just tried (in
Word 2003):

3-page document set for different odd and even, 3 heading 1 paragraphs, the
first two are on page 1 and the third is on page 2 (preceded by a manual
page break). The odd-page header has a styleref field for heading 1. The
header on page 1 shows the first heading 1 pagagraph. The header on page 2
is blank. The header on page 3 shows the last heading 1 paragraph (from page
2).





MJK said:
I have a document that has headings in it, each marked with the
appropriate style. I'm looking for a way to have the page headers reflect
the text of the previous "Heading 1" paragraph, or, if there's a "Heading 1"
paragraph on the page, the text of the first such paragraph. In other words,
I'm looking for something that behaves the way that STYLEREF is documented
as behaving.
I've tried using {STYLEREF "Heading 1" \* CHARFORMAT} in the page header for odd-numbered pages.

On page 1, this works perfectly and shows the correct text.
On page 2, there is a Heading 1 paragraph.
On page 3, the page header shows the original text (as in page 1) and
ignores the text of the Heading 1 paragraph on page 2.
In fact the odd-numbered page headers show identical text throughout the
document and ignore all "Heading 1" paragraphs except the first one.
As an experiment I tried inserting a (continuous) section break in the
middle of the document: the odd-numbered page headers after that point
reflected the last "Heading 1" paragraph *before* the section break.
Is it really necessary to insert a section break after every occurrence of
one's chosen style, if one wants STYLEREF to work properly?
 
M

MJK

I tried again. The problem occurs when the STYLEREF field is inside a text box. Sorry not to have mentioned it before: I didn't realise (until your reply) that it might be relevant.
 
S

Suzanne S. Barnhill

Yep, Word (especially older versions) has a hard time "seeing" anything in a
text box, since the text box is in the drawing layer.



MJK said:
I tried again. The problem occurs when the STYLEREF field is inside a text
box. Sorry not to have mentioned it before: I didn't realise (until your
reply) that it might be relevant.
 
M

MJK

I suppose I should have guessed: I've already had to write a macro to update page references in text boxes explicitly because Word won't do it.

My own suspicion is that someone has written a clone of Microsoft Word that is used *only* for text boxes, and that, like all clones, has only a passing resemblance to the original!

Anyway, I've removed the text box and laboriously recreated its formatting using paragraph styles, borders, tab stops, etc, and now STYLEREF works. Thank you for your help!
 

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