Results 1 to 13 of 13
  1. #1
    New Lounger
    Join Date
    May 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    STYLEREF and Paragraph Number (2000)

    I have used {STYLEREF} to put dictionary type headers on pages.
    What I want to do is get the page number of the first and last paragraph of a specific style on the page.
    I do not see how to do this with STYLEREF. My purpose is to put the optional phrase "(continued)" into
    the running header as a suffix to the {STYLEREF} text. That is, if a "Header 1" section continues to the
    next page, then: on its first page the running heading will have "MyHeader" on continuation pages
    it will have "MyHeader (continued)" The Word HELP points to information on "footnote continuation",
    but nothing on how to mark continued sections. I think STYLEREF is the way to go
    (as I do not want to hardcode a bookmark or heading cross-ref in the header
    (which would then require separate header for each section).
    Something like this, if STYLEREF had a switch to get the page number of the "Heading 1":
    {IF "{PAGE}" = "{STYLEREF "Heading 1" l # }" "" " (continued)" }
    The IF statement will add the " (continued)" whenever the current page is not the same as
    the page of the preceding (note the l switch) "Heading 1". .
    Another possibility would be a switch on STYLEREF which would return the _REFnnnn field
    found in PAGEREF fields. One could then combine {STYLEREF} and {PAGEREF} to get the
    page number of a specific header:
    {IF "{PAGE}" = "{PAGEREF {STYLEREF "Heading 1" l ?} }" "" " (continued)" }
    where the {STYLEREF} switch "?" returns "_REF09854".

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    <P ID="edit" class=small>(Edited by Phil Rabichow on 22-May-03 19:09. to add the last paragraph)</P>Hi Bill:
    I find this a fascinating problem. I don't know that I have a good solution, but...

    1. Suppose you define a style--let's call it "end"--that's in white font & 1 pt in size.
    2. With every Heading 1 style paragraph, you put in an "end" paragraph above & below it.
    3. The paragraph above says "Start" & the paragraph below says "Stop". (You can make autotext entries for these so you can insert them quickly. You can even define your Heading 1 style to use "end" for the following paragraph & define the end style to have normal text as it's following paragraph.)
    4. Now in the header, you add the following field:

    { IF { styleref end } = Stop "continued" "" }

    This field should be blank where the styleref = start (where the Heading 1 is contained on one page) & show "continued" when the Heading 1 spills over.

    Note: I just reread your post & realized that you wanted to search from the bottom up, but you can modify it with the l switch & change the IF field.
    ------------------------------------
    As I think about this, I would modify the steps above (if you think this is viable at all). Instead of a paragraph style above & below the Heading 1 style, I would just create a character style with white font & size 1 point. Then you can type the word "Start" at the beginning of each Heading 1 & "Stop" at the end of it.
    Hope this helps.

  3. #3
    New Lounger
    Join Date
    May 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    Does Word process the running header before processing the body of the page?
    I seem to be gettig inconsistent results with {STYLEREF "..." l } where the header
    contains the text of a style later in the current page, rather than the previous page.

    For my original application, I think that {STYLEREF} may not do all that I want. I
    would have to use only one level of heading throughout the section to create
    meaningful "dictionary style" running headers on the pages. I had originally
    planned to put {STYLEREF "Heading 1"} and {STYLEREF "Heading 2"} and
    {STYLEREF "Heading 3"} in the running header, since the spec I'm writing
    is organized with three levels of headers. But this gets messy in looking
    back to previous pages (the l switch), if the previous page ended with a
    "Header 1", for example. In that case, the running header would include
    the text of the last Heading 1 together with the preceding section's Heading 2
    and Heading 3. This isn't what I want.

    It sure would be nice if {STYLEREF} could return the label of a paragraph!
    Then that label could be used as part of a cross-reference to get the page
    number, the paragraph number, etc. Microsoft, are you listening?

  4. #4
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    And if your headings are numbered, you can also use the n switch in styleref fields to get the number (or the r or w switch) and use {IF} constructs to display the headings depending on the numbering (... for example to only show "Heading 2" if the chapter number is the same as the current "Heading 1").

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  5. #5
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    If you only want to show a styleref field if the style appears on the same page (and not if it appears on a previous page), a trick that I have used is to use a {page} field formatted in a white character style "SamePage" in each of the "Heading 1", and then use { IF { styleref "SamePage" }={page} {styleref "Heading 1"} ""}
    (edited: On re-reading the whole thread: This is rather similar to Phil's idea, with the added twist of using the {page} field)

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    Hi Bill:
    The styleref field starts searching the current page (different for each footer) from the top down. The footers on subsequent pages search their own pages top-down. If they find nothing, they then start searching from the top of their respective page upwards.

    If your first page is in a section by itself, Help says that Word searches the current section from top to bottom & then from the bottom of the section to the end of the document. However, I think it continues to search from the top of the section to the beginning of the document.

    To be honest, I haven't tested Word to see what happens if you put the styleref style in a header/footer. If you do some tests, I'd be interested in the results.
    Regards,

  7. #7
    New Lounger
    Join Date
    May 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    If STYLEREF searches are limited by section boundaries, I wonder how it will work to put
    a STYLEREF in the running header or footer? From the example in the HELP of making a
    directory, I assumed that the intent was to put the "first name on the page" and "last name
    on the page" headings in the running header. Otherwise one would have to put in explicit
    page breaks and STYLEREF tags at the top of each page (in the body of the page). This
    would defeat the purpose of searching for the previous and next paragraph using STYLEREF.

    I can do some experiments with putting STYLEREF in the running header, but this can be
    exhausting.

    I tried to put STYLEREFs in the first row of a table. The table allows rows to break across pages,
    and repeats the first row at the top of each page. Such a method works well for putting column
    headers on every page used by the table. Unfortunately, the STYLEREFs in that row are updated
    only for the first usage of the row (the first page of the table). When the row is repeated on later
    pages, the same STYLEREF text is used without update. Oh well. It seemed like a good way to
    put styleref information in the body of the page instead of in the running header. But it doesn't
    do what I wanted.

  8. #8
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: STYLEREF and Paragraph Number (2000)

    The helptext for the topic "Effect of the STYLEREF field location" says...
    <hr>Headers and footers (during printing)

    Word searches for the current page, from top to bottom. If the style isn't found, Word searches next from the top of the page to the beginning of the document, and then from the bottom of the page to the end of the document.
    If the l switch is used, Word searches from the bottom of the page to the beginning and then the end of the document.

    Headers and footers (when not printing)

    Word searches for the section that contains the STYLEREF field, from the beginning. If the style isn't found, Word searches from the end of the section to the end of the document.<hr>
    StuartR

  9. #9
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    Hi Stuart:
    I read that, too. Quite frankly, I find it very confusing. I don't know why there should be a different search order (if there is) before & during printing. I understand that fields are updated during printing, but it would be quite disconcerting to have the StyleRef field refer to particular text, think it was correct, & then have the fields change it during printing. One of these days, I'll have to test it out (unless you already have). <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  10. #10
    New Lounger
    Join Date
    May 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    Is the running header in a separate "section" from the body text? (Same for running footer?) I'm
    not sure of the terminology used in Word. When STYLEREF is in the page header or page footer
    (by this I mean the "running header" and "running footer"), and it searches "the section which
    contains the STYLEREF tag, is it simply searching the paragraphs in the page header (or footer)?

    I think not, as STYLEREFs seem to work okay in page headers.

    It's REALLY too bad that Word doesn't offer a tag like {MACRO macroname macroarg1 ... }. With such
    an inline macro invocation it would be easy to make a lot of trouble (grin!) but also one could create
    one's own behaviors. For example, enhance the {STYLEREF} tag to make it return the cross-reference
    name of the last or next "style". Using this one could construct a cross-reference link which calls out
    the cross-reference's text, paragraph number, page number, etc.

    When I asked about such an "inline macro" capability a few months ago (here and in Word online), I
    got no positive responses. Anyone else?

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    Hi Bill:
    A Header/Footer is not a different section from the main body (it's a different Story in VBA, but that's something else). Word uses section to define a set of formatting instructions for a given portion of a document that ends in a section break (or the last paragraph mark in a document). As far as I can tell, it doesn't search the header/footer area of the document.

  12. #12
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: STYLEREF and Paragraph Number (2000)

    I have tested this, but it was a long time ago.

    I remembered that the behaviour of a STYLEREF field in a footer could be very surprising so I looked it up. If I remember the exact combination where I spotted this then I'll post a description. I think it was a complicated nested IF with StyleRefs that behaved very differently in a footer to the way it behaved in the text.

    StuartR

  13. #13
    New Lounger
    Join Date
    May 2003
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: STYLEREF and Paragraph Number (2000)

    Okay, I tried the following in the page header (which is the right term: page header or running header?):
    In the example, I want to include the "Heading 3" in the running header, and add the words "(&sp.(continued)"
    if the current page is not equal to the page on which the "Heading 3" was defined.

    1. Immediately after each occurrence of the style, insert a {SET} field:
    { SET PrevH3Page "{ PAGE }" }
    2. Note that this records the page number where the last ""Heading 3" is defined.
    The {SET} is a hidden field, but does not show up when "Tools/Options/Show Hidden Text".
    To show the {SET} fields, type Alt-F9.
    3. In the running header for this section, include the following:
    { STYLEREF "Heading 3" }{ IF "{ REF PrevH3Page }" = "{ PAGE }" "" " (continued)" }

    On the page where the Heading 3 is defined, the running header will contain only
    the text of the Heading 3. On subsequent pages the running header will contain
    the text of the Heading 3, followed by " (continued)".

    I have not completely experimented with this: what if the first paragraph on the
    later page is a "Heading 3" with an attached "{SET}" field? The running heading
    should not include " (continued)". What if the user forgets to enter the "{SET}"
    field after every "Heading 3"? Then the suffix will continue... Does this work
    in the running footer?

    The advantage of this over the previous solution is that there is no "nonprinting
    white text".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •