Group:  Microsoft Word ยป microsoft.public.word.docmanagement
Thread: 'breadcrumbs' in header with conditional styleref

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

'breadcrumbs' in header with conditional styleref
jon.hertzig[ at ]gmail.com 22.09.2006 03:51:37
Just want to toot my own horn ... been wrastling with a problem that
was reported in several outdated posts: how to get a header to show
"breadcrumbs" in a complex document, eg so that it says "Heading 1 >
Heading 2 > Heading 3 ..." for whatever's on the current page (I have
a document with 8 levels of header and was wanting to show the
navigation on each page).

The problem is that the Styleref field searches for the first occurence
of a style (eg, Heading) up or down in the entire document, not just
the current page. So if you are on a page that only goes up to H3, it
would include the H4 from several pages hence in the document. There's
no way to use the PageRef or other fields to pick up the page number of
the StyleRef that it finds... but here's how I solved it:

Creating a character style that has no attributes, HeadChar, and
applying it with global search-replace to all headings. Then searching
for the first 'HeadChar' from the bottom up (\l), and if it matches a
style level, insert that style with all the previous levels. So, for
example, for level 3: {IF {STYLEREF "Heading 3" \n \l} = {STYLEREF
"HeadChar" \n \l} "{STYLEREF "Heading 1" \n \l} {STYLEREF "Heading 1"
\p \l} > {STYLEREF "Heading 2" \n \l} {STYLEREF "Heading 2" \p \l} >
{STYLEREF "Heading 1" \n \l} {STYLEREF "Heading 1" \p \l}" }

It works!

Re: 'breadcrumbs' in header with conditional styleref
jon.hertzig[ at ]gmail.com 22.09.2006 04:15:04
that last conditional should have had "Heading 3" instead of "Heading
1" at the end (so it's saying, if the first heading it finds starting
its search from the current page is a level 3 heading, then show
"Heading 1 (num & text) > Heading 2 (num & txt) > Heading 3 (num &
txt)" do this for every level, and add the HeadChar to a random
paragraph on the opening pages before the first H1 appears to suppress
the breadcrumbs on those pages.


jon.hertzig[ at ]gmail.com wrote:

[Quoted Text]
> Just want to toot my own horn ... been wrastling with a problem that
> was reported in several outdated posts: how to get a header to show
> "breadcrumbs" in a complex document, eg so that it says "Heading 1 >
> Heading 2 > Heading 3 ..." for whatever's on the current page (I have
> a document with 8 levels of header and was wanting to show the
> navigation on each page).
>
> The problem is that the Styleref field searches for the first occurence
> of a style (eg, Heading) up or down in the entire document, not just
> the current page. So if you are on a page that only goes up to H3, it
> would include the H4 from several pages hence in the document. There's
> no way to use the PageRef or other fields to pick up the page number of
> the StyleRef that it finds... but here's how I solved it:
>
> Creating a character style that has no attributes, HeadChar, and
> applying it with global search-replace to all headings. Then searching
> for the first 'HeadChar' from the bottom up (\l), and if it matches a
> style level, insert that style with all the previous levels. So, for
> example, for level 3: {IF {STYLEREF "Heading 3" \n \l} = {STYLEREF
> "HeadChar" \n \l} "{STYLEREF "Heading 1" \n \l} {STYLEREF "Heading 1"
> \p \l} > {STYLEREF "Heading 2" \n \l} {STYLEREF "Heading 2" \p \l} >
> {STYLEREF "Heading 1" \n \l} {STYLEREF "Heading 1" \p \l}" }
>
> It works!

Re: 'breadcrumbs' in header with conditional styleref
"Suzanne S. Barnhill" <sbarnhill[ at ]mvps.org> 22.09.2006 14:35:33
Thanks for this. I'm sure many users will find it useful.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

<jon.hertzig[ at ]gmail.com> wrote in message
news:1158898504.338260.28240[ at ]m73g2000cwd.googlegroups.com...
[Quoted Text]
> that last conditional should have had "Heading 3" instead of "Heading
> 1" at the end (so it's saying, if the first heading it finds starting
> its search from the current page is a level 3 heading, then show
> "Heading 1 (num & text) > Heading 2 (num & txt) > Heading 3 (num &
> txt)" do this for every level, and add the HeadChar to a random
> paragraph on the opening pages before the first H1 appears to suppress
> the breadcrumbs on those pages.
>
>
> jon.hertzig[ at ]gmail.com wrote:
>
> > Just want to toot my own horn ... been wrastling with a problem that
> > was reported in several outdated posts: how to get a header to show
> > "breadcrumbs" in a complex document, eg so that it says "Heading 1 >
> > Heading 2 > Heading 3 ..." for whatever's on the current page (I have
> > a document with 8 levels of header and was wanting to show the
> > navigation on each page).
> >
> > The problem is that the Styleref field searches for the first occurence
> > of a style (eg, Heading) up or down in the entire document, not just
> > the current page. So if you are on a page that only goes up to H3, it
> > would include the H4 from several pages hence in the document. There's
> > no way to use the PageRef or other fields to pick up the page number of
> > the StyleRef that it finds... but here's how I solved it:
> >
> > Creating a character style that has no attributes, HeadChar, and
> > applying it with global search-replace to all headings. Then searching
> > for the first 'HeadChar' from the bottom up (\l), and if it matches a
> > style level, insert that style with all the previous levels. So, for
> > example, for level 3: {IF {STYLEREF "Heading 3" \n \l} = {STYLEREF
> > "HeadChar" \n \l} "{STYLEREF "Heading 1" \n \l} {STYLEREF "Heading 1"
> > \p \l} > {STYLEREF "Heading 2" \n \l} {STYLEREF "Heading 2" \p \l} >
> > {STYLEREF "Heading 1" \n \l} {STYLEREF "Heading 1" \p \l}" }
> >
> > It works!
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net