"Ads by Goooooogle" links provided by Google.com, which has sole control over all advertising content it displays on this site.

Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2008 by Barry MacDonnell. All Rights Reserved.

Page updated July 24, 2007
DYNAHEAD - Dynamic headers (a/k/a "running heads" or "floating headers") -- i.e., headers that change page-to-page with the section, topic, or heading on the same page
(Also see The Header/Footer Machine for WP8 and WP9)

Three WP versions available:

For WordPerfect 9/10/11*/12/X3+ -
Download DYNA_WP9.ZIP
(v1.13; 10/19/06; 56,117 bytes)

For WordPerfect 8/9 -
Download DYNA_WP8.ZIP
(v1.10a; 8/25/00; 55,742 bytes)

For WordPerfect 7 -
Downoad DYNA_WP7.ZIP
(v1.09.07; 12/7/99; 23,892 bytes) Basically the same as version 1.09 for WP8/9 (above) but uses a wait message and status prompt instead of a progress indicator. Sorry, but this probably is the last version for WP7.

Downloading, Documentation, Modifications, and Support


* - If you use WordPerfect 11, see information about using macros (from any source, not just this website) in the first release of WordPerfect 11 (i.e., build 11.0.0.233, as shown in WordPerfect's Help > About ...)

Purpose

DynaHead is a macro that produces "dynamic headers" or "floating headers" -- i.e., headers that change page-to-page with the section, topic, or heading on the same page.

DynaHead is useful for manuals, reports, directories, company phone books, catalogs, parts lists, glossaries, etc. -- wherever you need to identify pages with a header topic that relates to a topic on the same page.

Advantages

The main advantage is that you do not have to go to each page, decide on -- then select -- a heading or other phrase, copy the selection to the clipboard, create a new Header on that page, edit the Header, paste the copied text into the Header, justify it, exit from the Header, then go to the next page and repeat the process. DYNAHEAD does all this for you.

Options

Several formatting options can be selected from a menu to allow you to customize the "look" or "style" of the headers, including placing them

  • in Header A or Header B
  • on alternating pages (left-justified on even pages, right-justified on odd pages)
  • in a "dictionary" style (Word A - Word Z on each page)
  • with outdented header margins
  • formatted with various font attributes and/or relative sizes
  • with preceding text strings (e.g., "Chapter 5 - ")

How it works in general

The macro searches for section headings or other body text that was previously marked ("tagged") with Paragraph styles or Character styles (see also the limitations below). When it finds the chosen style on a page (you will have already chosen the style's name from the macro's menu), it copies the text to which the style was applied and pastes it into a new header on the same page. It then proceeds page-by-page to the end of the document, creating new "dynamic" headers as it goes.

For example, you could set DYNAHEAD to find all instances of a standard WordPerfect paragraph heading style that exists in the document, such as the "Heading 2" style. (The standard style named "Heading 2" must have been applied to text somewhere in the current document. Many users find these standard Heading styles convenient since they also cause their text to automatically appear in any Table of Contents you might generate.) Or, you could have DYNAHEAD find a user-defined (a/k/a custom) style such as "MyStyle3" that was used in the document. The text to which these styles were applied will appear in the Header on that page, formatted in the manner dictated by the options you chose on the macro's menu.

How it works on each page

The first instance of text marked by the chosen style that is found on a page is copied to the header on that page. The last instance of marked text (which could be the same as the first, or it could be different) is stored and used on any subsequent page that doesn't have any marked text, so that there is a "carry-over" effect on intervening pages. In other words, all pages will always have dynamic headers. [If dictionary-style headers are chosen, the last marked text is used inside the same header, thus: "Word(s) A • Word(s) Z". Dictionary-style headers also alternate their justification on odd/even pages.]

Notes and known limitations

  • Paragraph styles -- such as the five WordPerfect default Heading styles -- end with a hard return, and are often used for document headings or other sectional divisions. Character styles, on the other hand, can be applied to words, phrases, or larger blocks of text, and do not require a hard return. Dynahead works best when either type of style is only applied to short blocks of text, such as a word or a phrase; otherwise, you could produce headers that are too large or "crowded." (See also the known limitation about styles that span more than one page, below.)
  • Document ("Open") styles are not supported. Unlike Paragraph and Characters styles, which are produced by a pair of codes, there is no ending code in a Document style. Because of this characteristic the macro cannot find the end of the block of Character-style-marked text; therefore it cannot copy that text to the page headers. Only Paragraph and Character styles are supported.
  • If you later add or remove text or graphics from your document, play DynaHead again to refresh the headers. Dynamic headers of the type used here are not automatically updated when you make changes to your document. (A message displays after the macro completes its work to remind you to replay the macro after revising a document.)
  • If you plan on using a Table of Contents (TOC) or an Index, you should create the TOC or Index after playing DynaHead -- or at least regenerate the TOC/Index after you have finished with DynaHead. DynaHead creates headers on every page, and since headers (like footers) "encroach" on the body text area, the creation of headers can push body text downward into the document due to the decreased size of the body text areas on each page. This can cause a pre-existing TOC or Index's page numbering to be incorrect for some pages. It is a good idea to regenerate a TOC and Index after playing DynaHead.
  • A style (i.e., the marked text to which a style has been applied) that is split over two pages may sometimes produce incorrect headers because the macro searches for the beginning and ending of a given text style on a page-by-page basis. Try to confine text that is marked with a style to a single page. (You can "block protect" styles: See "BPSTYLES - Block protects paragraph styles (e.g., "Heading 2") and following body text".
  • Hidden text codes ([Hidden] and [Hidden Txt]) can be problematic (in WP8 they caused some search code to go into a loop).
  • Multi-page tables can slow down the macro as it locates the top of each page. On occasion these tables may cause the macro to produce improper header text on the last page, or even cause the macro to fail.
    • One solution that has ben reported to work is to temporarily remove the table (i.e., copy it to an empty document), play the DynaHead macro, then insert the table back in the appropriate location. Use Reveal Codes to ensure that you also copy the table's [Tbl Def] and [Tbl Off] codes, which include the table's formatting.
  • Pre-existing [Suppress] codes on Page 1 can be problematic. For example, if the macro has been previously played on the same doument with the "Suppress header type (A or B) on page 1" option selected, and is subsequently played with this option deselected, a header still will not appear on Page 1. In this event, manually delete the appropriate [Suppress] code in the Reveal Codes window. For more on the suppress feature, see here.
    • Note that the macro language cannot tell what type of suppress code it finds in a search, so coding around this problem is not possible since a user may have used several such codes with differing purposes.

Tip

If you want to add your own custom style names to the menu's drop list, here's a procedure (tested in WP12) that should do the job, but it requires editing the macro and using the macro's Dialog Editor -- something that probably will appeal only to intermediate or advanced users.

Example: Suppose you have a custom paragraph style named "Stepped 2." Open the macro for editing and carefully follow these steps.

Step 1.

Click the Dialog Editor button on the macro toolbar. The PerfectScript dialog window appears.

Step 1a.

Double-click "menu1" to open the standard (non-metric) DynaHead menu for editing. ("menu2" is for metric users.)

Two new dialogs open on screen: the PerfectScript Dialog Editor toolbar, and the DynaHead menu (in dialog editing mode).

Double-click anywhere on the DynaHead menu's style name drop list to being up the Combo Box Properties dialog.

Step 1b.

Click the Create/Edit list button in the Combo Box Properties dialog; in the "List item:" field, enter (without quotes) "Stepped 2" and click OK. (Note that names are case-sensitive.) The new style name will be added to the list.

Repeat Step 1b for any other custom paragraph style names you want to add. (When you are using Create/Edit List, you can select an item and use the Move Up and Move Down buttons, as well as Set Initial to set the initial menu selection the user will see.)

When you are finished adding to the "List items:" field, click OK from the Combo Box Properties dialog to dismiss the dialog.

Step 1c.

On the other "floating toolbar" dialog (i.e., the PerfectScript Dialog Editor dialog), click the Save button (or use File, Save from the Editor's menu). Then use File, Close from the Editor's menu.

You should now be back in the main macro document window, editing it.

Step 2.

Now you need to modify some of the macro's commands.

At about line 137 in the macro code, you'll see this line of code (it will be all on one line):

Default: vStyleNameorEnum := vEntryStyle Break // Store user-defined style

Just above it, carefully enter this line of code (type all on one line):

CaseOF "Stepped 2": vStyleNameorEnum := "Stepped 2" Break

(Note that style names are case-sensitive.)

Repeat Step 2 for any other style names you added in Step 1b.

Step 3.

When finished, click the Save & Compile button on the macro toolbar. This will save the changes you made in Steps 1 and 2.

Play the macro on a document that has the Stepped 2 style in it.

Page Top Disclaimer, Distribution, and Privacy Policies