| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Nov 27, 2013
|AlphaDiv - "Alphabetical List Divider" - Divide any alphabetical list with capital letters|
Divider.wcm is a macro that divides any alphabetized list of
words or short phrases -- such as a generated WordPerfect index or an organization's phone directory -- with either the
appropriate capital letter "heading" (A, B, C, etc.) between each
section or a blank line between each section. For example:
The initial alphabetized index or list should be composed of words or short phrases. (To divide longer paragraphs, see the alternative macro below.)
Note about v1.02 (06/15/2012):
The macro can now optionally detect indented lines (e.g., subheadings in a
generated index) to skip past them during processing. It also has an option
to insert a hard return after the dividing letters, and an option to
enclose dividing letters in text boxes.
1. Always make a backup copy of the document first.
2. Be sure to place cursor on the first line of the alphabetical list. (The macro will display a reminder.) The macro starts processing on the current line and continues to the end of the document. The list should not be formatted into tables or columns (these can be added later), and nothing should follow the list.
3. Then play the macro. A small menu will appear.
Several options are available from a menu [image], including letting you choose between using letters or just blank lines to divide the list; setting the relative size of the divider letters; setting the default font or alternative font; the letter color; the justification of the letters (left, center, right); whether to skip over indented lines (such as subheadings in a generated index); and/or put the divider letters in text boxes.
Default values for the menu (and the macro operation) can be set in the macro's User Modification Area at the top of the macro code. Just open the macro for editing with Tools, Macro, Edit. When you have finished making changes click the Save & Compile button on the macro toolbar.
The alphabetical list should not be inside a column, header, footer, text box, comment, or other substructure. The macro will work only inside normal body text. If the cursor is inside any of those format structures, a warning message will appear and the macro will then exit.
If you require special additional formatting for the list (e.g., set it in columns or tables) you should add that formatting after this macro is played on the list. This probably is best done on the final draft of the document -- especially if the list is a generated index, since re-generating an index completely removes the previous version of the index (including any dividing characters or other special formatting you might have added to the index entries).
The macro contains small optional routines to skip over any indented items such as subheadings in generated indexes, which should not have alphabetical dividers. [The default for this feature can be set in the redlined User Modification Area below.] If you choose to use the option to "Skip over indented lines," which is "On" by default:
The macro has an option to insert the divider letters inside text boxes. Note that if you wish to Undo this operation with Edit, Undo (or Ctrl+z), you might have to set the program's Undo history to a large amount (even the maximum of 300). Of course, you can always close the list document without saving it, and then reopen it for further processing or testing.
After the macro plays you could add special formatting to the letters. For example, if you did not choose to use the “Enclose letters in a text box” option you could double-click individual letters and enclose them in a "reverse-text" box with the WordPerfect shipping macro, Reverse.wcm. This turns the letters into white-on-black (or whatever two-color combination works best).