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 Feb 13. 2017

Macros that quickly produce either -
•  a short signature or other "fill in" line                                 (◄- like this)
•  or a line up to the right margin, like this:                                                                   
•  or text centered between margins with automatically adjusted lines, like this:
                                                           TITLE
                                                         

Download UNDERLIN.ZIP (v1.01; 11/04/05; 16,025 bytes)

Compatible with WordPerfect versions 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

Purpose

The following macros are based on a combination of these WordPerfect features that you could use yourself from the WordPerfect menu:
(1) Format, Font, Underline (the top tab), Text & Tabs
(
in WordPerfect 8 it was Format, Font, Underline, Text & Tabs);
(2) Format, Font Underline
(3) Format, Line, Flush Right or Format, Line, Center.
However, you might find these macros more useful, since they are fast, easy to use -- and they also reset your current setting for underlining (#1 above) following the location where they were applied.

All three individual macros are included in the download (ZIP) file:

•  UnderlineTab.wcm (v1.01) - A macro that creates an underlined tab space. Each activation produces another underlined tab, up to the right margin.

It is useful to quickly create a signature line or similar short line below the text's baseline.

•  Note that you can create the tabbed underlines and then type over them. But they will also expand rightward as text is added past the last  underlined [Tab] code. (Use Reveal Codes to see what is going on at the cursor location.) The main purpose, however, is to create a signature line that will be used as such on the printed copy.

• 
Underline2Margin.wcm (v1.01) - A macro that creates an underline from the current cursor position -- i.e., after the last text character on a line -- up to the right margin to "fill" the space with a line. It then (optionally) enters a hard return [HRt] and (optionally) returns the cursor to the starting point. This allows the line to automatically expand or contract if previous text on that same line is edited.

It is useful (for example) to create a section divider that visually separates a description from following text.

A small caution ...

Underline2Margin was designed to work with regular body text. It does not work properly inside character styles or paragraph styles (such as Heading 1, Heading 2, etc.). If it is played in such a style it might underline everything in that style.

[This is program issue, not a macro issue, whenever some text attributes like underlining are applied at the very end of the style's text -- i.e., just before the ending [CharStyle] or [ParaStyle] code.]

If that happens, you can Undo it immediately with Ctrl+Z. [Alternatively you can delete the [Undrln Tab][Hd Flush Right] codes from the style's text (use Reveal Codes), then double-click on the [Style] code to remove the [Und] code from inside that [Style] code.]

Note

If the new underline is created on the last line of a page, it will not cause a new page to be generated. [Any (optional) hard return at the end of the underlined area is removed.]

Tips

☼ 
If you do not want the cursor to return to the beginning of the current underlined area, and/or you do not want a hard return entered at the end of the underlined area, you can change these defaults in the macro's redlined User Modification Area. (Similarly you can add other options like bold, large font size, etc., to the text.) Just open the macro file for editing with Tools, Macro, Edit.

☼  You can use this underline-to-margin format to (e.g.) create a watermark with a column of underlines on one side of the pages so they will appear adjacent to, and aligned with, the lines of text on the other side of the pages. [Screen shot]

This can be useful for adding written comments to the printed document during editing. See the macro in Footnote 1.

•  Underline2Center (v1.0) - This macro creates a "expandable underline" from the current cursor position (usually, the beginning of a new line) to the center position (i.e., between both margins) and thence to the right margin (i.e., the end of the current line). It then optionally enters a hard return and returns to the center of the line, where text between the underlines is entered via a pop-up dialog (the dialog itself can be suppressed).

It is useful in creating unique section headings and similar items, especially since the lines adjust automatically to the width of the centered text.

Tips

• 
If the new underlines are created on the last line of a page, it will not cause a new page to be generated. [Any (optional) hard return at the end of the underlined area is removed.]

•  If you do not want a hard return entered at the end of the second underlined area, you can change this and several other defaults in the macro's redlined User Modification Area.

•  Once the item is created, you can add text to the very beginning and/or very end of the line by moving the cursor (in Reveal Codes) before the first [Und] code and/or after the last [Und] code. This produces left-center-right text joined by underlines.
These macros "remember" your default settings in Format, Font, Underline and restore them immediately after the macro plays with another [Undrln Tab] code in the text.

Tips


The macros can be assigned to toolbar buttons or keystroke combinations.

For example, to use a toolbar to play the macro:

•  Edit your toolbar or property bar and create buttons to play the macros:

[1] Right-click the toolbar or property bar where you want to place the buttons.

[2] Choose Edit from the drop-down context menu, then click the Macros tab, then click the Add Macro button.

[3] Choose the name of the macro from the file dialog that opens. Click Select.

Note: Generally, you can answer "No" to "Save macro with full path?" if the macro file (*.wcm) is located in your default or supplemental macros folder. If it is not, answer "Yes."

A (default) gray "audiocasette" icon appears on the right side of the toolbar or property bar.

[4] With the tool- or property bar's Editor dialog still open, right-click the new icon to open the Customize Button dialog. Customize the icon with some descriptive text and a tool tip.

[5] Click OK twice to return to the main document window.

Repeat the above steps for the other macros.

•  Next, (optionally) change the button's default icon.

Note: The methods you can use to change the icon image depend on your version of WordPerfect. See "How to change those default "audiocassette" icons on toolbar buttons after assigning macros to them (or change any toolbar icon)" here.


Footnote 1

[Continued from the Underline2Margin section above...]

The macro code below is based on the Underline2Margin macro above.

When played it creates a relatively narrow column of underlines inside a previously created watermark in the document.

Here's an example of the result, showing a portion of two pages of text:

Sample document with a column of underlines


This format can be useful for adding written comments to the printed document during editing.

The underlines displayed via the watermark should follow the same vertical alignment as the lines of text in the body of the document, and they will continue in the document (unless discontinued - see Tips below).


Instructions


The following assumes left/right page margins in the document are set to 1.0", but they can be set differently -- in which case you probably will need to adjust the margins in the watermark (see Tips below).

First, in the main document text area set the right page margin to 4.25" (see Format, Margins, Right: 4.25", OK). All document text should now be in a single narrow "column" on the left side of all pages (see image above).

Second, on that page create a watermark (either A or B -- your choice).

Third, while in the new watermark window, play the macro. (Note that it uses a 4.5" left page margin setting, but you can use whatever value you wish.)

To copy this code into your WordPerfect program to create a working macro, see here.

// Macro begins here

// Creates a "column" of underlines from the left margin to
// the right margin, from the page top to the page bottom.
//
// Set the left margin where the "column" of lines should begin:
vLeftMarginSet:=4.5"
//
MessageBox(vAns;"Make a column of underlines up to the right margin";
    "This macro should be played inside a"+NToC(0F90Ah)+
    "WATERMARK (A or B) for best effect."+NToC(0F90Ah)+NToC(0F90Ah)+
    "Do you wish to continue?";YesNo!|IconQuestion!)
    If(vAns=2 or vAns=7) Quit Endif  // 'Cancel' or 'No'
If(?CurrentSubDoc<>{7;8}) // (i.e., Not in a watermark structure)
    Messagebox(vAns;;"You are not inside a watermark."+NToC(0F90Ah)+
    "Do you still want to continue?";YesNo!|IconQuestion!)
    If(vAns=2 or vAns=7) Quit Endif  // 'Cancel' or 'No'
Endif
// Determine the current Format> Font> Underline choices; "remember" them
// with flags; then turn ON the settings to underline tabs and spaces -
If (?UnderlineTabs = True)  vUndTabsFlag:=1
Else  vUndTabsFlag:=0  UnderlineTabs (Yes!)  Endif
If (?UnderlineSpaces = True)  vUndSpacesFlag:=1
Else  vUndSpacesFlag:=0  UnderlineSpaces (Yes!)  Endif
// Start at the top:
PosPageTop
MarginLeft(vLeftMarginSet)
vPg1:=?Page
// Insert separate lines up to the right margin:
While(True)
    // Turn underlining ON, add a flush right code:
    AttributeAppearanceOn (Underline!)
    FlushRight
    // Skip past the last [Und] code, enter a hard return
    PosCharNext
    HardReturn
    // If cursor is on the next page, go back a page:
    vPg2:=?Page
    If(vPg2>vPg1)
        DeleteCharPrevious
        Break
    Endif
Endwhile
// Reset user's default Format> Font> Underline choices -
If (vUndTabsFlag = 0)  UnderlineTabs (No!)  Endif
If (vUndSpacesFlag = 0)  UnderlineSpaces (No!)  Endif
// Exit macro here:
Display(On!)
Messagebox(;"Finished";
    "You can Close the Watermark now from the"+NToC(0F90Ah)+
    "property bar -or- with File> Close.";IconInformation!)
Return

// Macro ends here

Tips

☼  You can
adjust the width of the column of underlines by editing the watermark and drag the margin guidelines leftward or rightward to make the underlines column wider or narrower. Alternatively you can just specify a different value for the left margin near the top of the macro code above.

☼  You can discontinue the watermark further into the document to stop the lines with Insert > Watermark > (choose the watermark you used) > Discontinue.