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

Barry MacDonnell's
Toolbox for WordPerfect

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

Page updated Mar 17, 2013

HSPACER - Converts normal spaces in selected text to hard spaces to prevent word wrap in phrases, legal citations, etc.

Download HSPACER.ZIP (v1.01; 07/13/04; 7,208 bytes)

Compatible with WordPerfect 8 and later versions

WordPerfect 11 users: See important information about using macros in the first release of WP11 (11.0.0.233) at the top of this page.

Downloading, Documentation, Modifications, and Support

Hspacer.wcm deletes ordinary spaces in previously selected text, and replaces each space or group of spaces between words with a single hard space ([HSpace]) to keep the words together on the same line. This prevents the words from being split between lines by word wrap.

There is no menu; simply select the text and play the macro.

NOTES

HSPACER is meant to be used on short phrases, legal citations, etc.

If the selection extends beyond the end of a hard return [HRt] or paragraph end, the macro will stop processing spaces at the end of the line and exit. [The code to do this is in redline, and may be deleted if this limitation is not desired.]

However, HSPACER will allow you to select and convert pharses that have soft returns -- i.e., pharses that are word wrapped to the next line or page.

Note also that selecting too many words -- i.e., words that will not fit between the current margins after hard spaces are added between them -- will cause the remainder of the selection to be truncated following a temporary soft return. This is expected behavior: Hard spaces are meant to keep words from wrapping, and if all words joined with hard spaces cannot fit on a line, the line will be split and wrapped to the next line.

TIPS

Hpacer.wcm may be more easily accessed by assigning it to a keystroke combination (such as Ctrl+1) and/or to a toolbar button.

Hspacer.wcm may also be useful in "marking" phrases for the author's WordList macro. That macro can create a separate ("concordance") list of unique words in the document, which then can be edited to remove unwanted words and used to help index a document.

The Hpacer.wcm's code demonstrates a method of processing just the selected text, on a character-by-character basis. When the processing reaches the end of the selection (marked with a temporary Quickmark), the macro terminates. The technique may be useful in other macros.