[Thanks to Graham Ginsberg for the original
idea and suggestions during development.]
Related macro -
LOCKTEXT - Lock text together (i.e., block protect selected words with a mouseclick)
BlockProtectParaStyles.wcm - A macro that automatically adds block protection
(same as Format, Keep Text Together, Block Protect) to all
user-specified or default paragraph styles (e.g., Heading 1 -
Heading 5) found 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 (highlighted here in yellow):
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 paragraph styles to text 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, such as custom paragraph styles you have
previously created and which are available in your document.
The macro can be played any time 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.
See also Conditional End of
Importnt notes and comments
- The macro processes only specified paragraph
styles that have been used in the document, such as (by default)
WordPerfect'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.
- Character Styles or Open (Document) Styles
are not processed, just Paragraph Styles. (The type of style is shown
in the dialog that displays when you click Format, Styles, and choose a
style from the list in the Styles dialog.) A paragraph style has a
built-in hard return at the end that delimits the text inside the
applied style. See here for more on
- Up to five paragraph 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
- 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
What about using Conditional
End of Page (CEOP) -- accessed via Format, Keep text Together?
Conditional End of Page 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
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 applied (rather than using
plain text) for headings, sections, or titles.