Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

StyleRef Field Not Working Across Pages

Status
Not open for further replies.

tcarroll5601

Technical User
Feb 19, 2009
6
US
I have inserted a StyleRef field into my header. It references my Heading 1 style. When one of my Heading 1 paragraphs ( or any subsequest paragraph, i.e. Heading 2, Heading 3, etc.) breaks across a page, the field does not continue the reference at the top of the page; instead the field picks up on the NEXT Heading 1 style to be found on the current page - even though the current page begins with text from the previous Heading 1 number.

I know that this field is supposed to automatically start at the top of the page, but can I make it search the previous page so that it continues the numbers across the page?? Please advise!
 
Hi tcarroll5601,

Your STYLEREF field probably has the '\l' switch, which tells it to pick up the last heading on the page or, if there is no new heading on that page, the last such heading.


Cheers
[MS MVP - Word]
 
Well, I actually have another field with that switch on in my header as well. The goal is to have one field on the left of the header that lets the reader know which Heading 1 paragraph the page starts with, and to have another field on the left that lets them know which Heading 1 paragraph the page ends with. For example:

Section 345.1 Section 345.4


...which means that the page starts with a paragraph from Section 345.1, and the page ends on a paragraph from Section 345.4.

The \1 switch is on in the field to the right, but not on the left. The field on the left has the \n switch on.
 
Hi tcarroll5601,

I think you'll have to accept that what you're seeing reflects the way STYLEREF fields are meant to work. Maybe there's a logical reason for allowing a heading to be split over two pages, but it doesn't make sense to me.


Cheers
[MS MVP - Word]
 
the \l switch does not " tells it to pick up the last heading on the page ". It tells it to start the search for the style from the bottom of the page backwards.
Instructs Word to search from the bottom of the current page, rather than from the top.

So, if I understand correctly...

Section 345.1 (Heading style)
345.1 paragraphs following
345.1 paragraphs following
PAGE BREAK
[highlight] 345.1 paragraphs following[/highlight]
345.1 paragraphs following
Section 345.2 (Heading style)
345.1 paragraphs following
345.1 paragraphs following
345.1 paragraphs following
Section 345.3 (Heading style)
345.3 paragraphs following
345.3 paragraphs following
Section 345.4 (Heading style)
345.4 paragraphs following

...for brevity, ignoring the MERGEFORMAT...

{STYLEREF "Heading 1"} {STYLEREF "Heading 1" \l}

produces

Section 345.2 Section 345.4

Even though the first paragraph is from 345.1, it will NOT be picked up by STYLEREF, as it searches the current page.

Unless there is not one. In which it will go back.

Section 345.1 (Heading style)
345.1 paragraphs following
345.1 paragraphs following
PAGE BREAK
[highlight] 345.1 paragraphs following[/highlight]
345.1 paragraphs following
etc. etc.
PAGE BREAK

In this case, yes, it will produce:

Section 345.1 Section 345.1

but if there IS one, that is the one it will use.

So yes your page may very well start with a paragraph from 345.1, BUT, if there is a new Heading (345.2) on the current page, Word will not go back a page.
...which means that the page starts with a paragraph from Section 345.1, and the page ends on a paragraph from Section 345.4.
Except if the actual paragraph with the style (Section 345.1) is on th eprevious page, it will not be picked up, if there is a newer one on the current page. If there is no newer one on the current page, it WILL be picked up. I agree with macropod:
I think you'll have to accept that what you're seeing reflects the way STYLEREF fields are meant to work.


"A little piece of heaven
without that awkward dying part."

advertisment for Reese's Peanut Butter Cups (a chocolate/peanut butter confection)

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top