| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
|Page updated Mar 17, 2013|
|HSPACER - Converts normal spaces in selected text to hard spaces to prevent word wrap in phrases, legal citations, etc.|
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.
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.
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.