Word - Populate Headers with Correct EAR information

Asked By Bob on 02-Jun-12 09:34 AM
Hi,

I need to implement the following information in running headers
throughout a portion of a document.

Different Odd / Even hearder (easy)
On Odd pages
if no headings (level 1, 2,3,or 4) no text
if any of heading level 1,2,3,4 first occurrence on page of the
heading number

On even pages
if no headings (level 1, 2,3,or 4) no text
if any of heading level 1,2,3,4 last occurrence on page of the heading
number

I have explored Styleref but, because it remembers the heading numbers
from previous pages, it does not support all the requirements.


I was thing about the following approach
setup standard headers and use styleref to point EarContent style

iterate through each page
Search through the page
depending on even or odd page, extract the correct outline number
extract the ear test (eg. 1.2.a.ii) for a level 4
write the text to the page at the end and style it with a character
style (EarContent) (the style is white and small pt size)
next page

This way the simple styleref picks up my text,

is there a non vba solution?

Thanks,

Bob


Bob replied to Bob on 02-Jun-12 05:05 PM
The example of the ear text above should be ii (only showing the final
level found)

So if a heading 1 is found first on an odd page, the heading 1 number
is shown in the ear text
If a heading 2 is found first on the page, the heading 2 number is
shown in the ear text

what ever the last heading is found on the even page is shown in the
ear text.

Thanks for any help.
Bob replied to Bob on 05-Jun-12 03:04 PM
r

Looks like VBA is the way to go.
Does anyone know of a commercial add-in that might do this?
Stefan Blom replied to Bob on 06-Jun-12 04:33 AM
As you have noticed, Word does not do this very well. The STYLEREF field
is designed to display the "current" heading, using a *specific* style.
To a certain extent, you can control this by using a character style
(that does not change the formatting of text) and apply it on top of
relevant headings, but with your requirements it is likely to be a
maintenance nightmare.

Stefan Blom
Microsoft Word MVP
Bob replied to Stefan Blom on 10-Jun-12 08:30 AM
Hi Stefan,

Thank you for the confirmation.
I have been able to create a character style the editor paints the required item with. The font colour of the eartext style is red for visibility.

The field code in the headers is as follows:

{if {styleref eartext \w} = "0" " " {styleref eartext \w}}

The style gets painted on to the appropriate heading entry, the styleref picks up what was tagged. If the ear is to be suppressed, the editor paints a paragraph that does not have a number (hence the check for 0 (zero)

I assigned CTRL-e to apply the eartext style.
I also wrote a very short macro to toggle the colour of the eartext style from red to automatic. (Assigned to QAToolbar)

The editor walks through the doc and can tag 60 pages in under 1 minute.
Once they are happy with the outcome, they toggle the colour and update the table of contents, etc.

I would not have been able to cobble together this solution without the community of MVPs. Thank you.

Cheers.

Bob
Stefan Blom replied to Bob on 11-Jun-12 05:06 AM
I am glad you were able to solve this! :-)

Stefan Blom
Microsoft Word MVP