"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 Jan 9, 2008
BPSTYLES - Block protects paragraph styles (e.g., "Heading 2") and following body text

Download BPSTYLES.ZIP (v1.09.01; 10/22/07; 28,673 bytes. Includes a WPD document demonstrating and explaining the macro's operation.)

Compatible with WordPerfect 8,9,10,11,12,X3

Downloading, Documentation, Modifications, and Support

BlockProtectParaStyles.wcm - A macro that adds block protection (same as Format, Keep Text Together, Block Protect) to all user-specified or default paragraph styles (e.g., Headings) in a document, to keep the style and the next two lines of body text together on the same page. The resulting Block Protect codes will be placed like this in Reveal Codes:

[Para Style: AutoHeading 1>[Block Pro>[Style]THE STORY OF MY LIFE<Para Style: AutoHeading 1]
[HRt]
[HRt]
It was a dark and stormy night; the rain fell in torrents--except at
<Block Pro]occasional intervals, when it was checked by a violent gust of wind which swept up the streets . . .

Naturally, as in the example above, you must have some paragraph styles in the current document for the macro to block-protect. Normally, to apply these paragraph styles you simply place your cursor anywhere on a heading, section, or title line and choose a paragraph style from the Style List on the Text Property Bar (or click Format, Styles, choose a style, then click Insert). Most users probably will use the default Heading 1 through Heading 5 styles, but you can use any available paragraph style.

The macro can be played anytime and multiple times in any document. If you insert new section labels, heading lines, etc., just play the macro again. Do the same if you delete blocks of text to ensure that all styles are properly processed.

Thanks to Graham Ginsberg for the original idea and suggestions during development.

Notes and comments:

  • The macro processes only user-specified paragraph styles that have been used in the document, such as WP's own Heading styles shown in the Select Style list on the Text Property Bar. The default paragraph style used by the macro is Heading (i.e., Heading 1, Heading 2 ... etc.).
    • So ... if you have simply keyboarded a "heading" (e.g., typed a phrase, hit the <Enter> key twice, then continued with the body of the paragraph) ... BPStyles won't do a thing for you. You might try Conditional End of Page (see below). But if you use WordPerfect's Heading styles (or any custom paragraph style) for the paragraph or section heading, you may find it helpful.
  • Up to five style name(s) can be specified in the macro's code in the redlined User Modification Area, of which Heading is one. You can specify four other custom paragraph styles if they are present in the document or the default template. Please read the comments at the top of the macro's code if you need to add custom styles. (Open the macro as you would any other WP document, make the changes according to the instructions at the top, then Save & Compile the macro with the button on the Macro toolbar.)
    • If all you use are WP's built-in Heading styles to create paragraph or section headings, you do not need to modify the macro. 
  • If there is only one text line following the heading line, only that line will be included with the heading line. No blank lines following that text line will be included.
  • If there are two adjacent paragraph styles -- for example, a heading followed immediately by a sub-heading, with no text between them -- both styles will be locked together with Block Protect so that they will remain together on the same page. If this is undesirable, simply open Reveal Codes and delete that particular Block Protect code.
  • Starting with version 1.08, Widow/Orphan protection (Format, Keep Text Together, Widow/Orphan) is used by default at the top of the document. Widow/Orphan protection prevents the first and last lines of a paragraph from separating across pages. You can remove this option in the macro's User Modification Area.
  • Srarting with version 1.09, you have the optional ability to have just the last two lines of a paragraph style (such as a legal citation) and the following paragraph block protected, See the included document or the macro's User Modification Area for more information.

What about using Conditional End of Page (CEOP) -- accessed via Format, Keep text Together?

CEOP has been reported to work inconsistently, especially with counting blank lines following a paragraph heading style, since the number of such "textless" lines could vary in a document.

What if you put the CEOP inside the paragraph style? As Noal Mellot, a WP Universe guru, stated: "CEOP will, in a paragraph style, keep together any text encapsulated in the style itself ... ; but it will not keep this text together in any consistent way with text outside the style."

Also, setting the CEOP's value properly (to keep headings and following text together) requires you to take into account not only the expected number of blank lines following the heading, but also any double-spacing or other-size-spacing (if used), sub-heading lines (and any hard returns that separate them), etc. For example, if you select "CEOP: 2", this will "keep together" two lines of single-spaced text, but only one line of double-spaced text.

Moreover, if you have multi-line paragraph-style headings followed by one or more blank lines, the heading and following body text might not be "kept together" by the current CEOP setting, since the CEOP will count the number of lines in the larger heading and fall short of the needed value at that location.

It seems to this author that BPStyles is a better solution when paragraph styles are used as headings.

Page Top