Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
Page updated Dec 6, 2017
Main tips page | Browse tips
A primer on
Some resources -
Getting the most out of Reveal Codes in WordPerfect. A short Corel Tutorial by Laura Acklen.
Cracking the Codes in WordPerfect 11. (Even though written for WordPerfect 11 it still remains useful for later versions.)
Reveal Codes list (in PDF format). (Download location of a compiled list by a WordPerfect Universe moderator.) Some newer codes are not listed, but the document should still be very useful.
[New for WordPerfect X8:] The Corel site has a PDF: "WordPerfect Reveal Codes Chart" on their download page here.
Reveal Codes is a WordPerfect on-screen feature that lets you "look behind the scenes" for specific details about your document's formatting -- and even let you change current formatting or correct formatting mistakes quickly and easily.
Most long-time WordPerfect users, especially those who have also used other products, would probably tell you it is one of the most important reasons -- if not the main reason -- they use WordPerfect.
With WordPerfect, items responsible for formatting (as well as for objects like graphic boxes and tables) are visible as format codes in the Reveal Codes pane when it is open below the main document area.
[New with WordPerfect X8: You can use a toolbar button to dock the pane on the left, right, or bottom of the document area.]
This pane -- which has been called a "second editing screen" since it has its own [red] insertion cursor -- can be toggled open and closed with Alt+F3.
The codes can help tell you what is happening at any given point. One author (see Acklen in the sidebar) suggests that even new users can greatly benefit by observing how and when codes are inserted in the document's steam of text. This helps users better understand how formatting is accomplished in WordPerfect, which can help them modify that formatting, remove unwanted formatting, or untangle format problems.
And if that wasn't helpful enough, double clicking on a code in Reveal Codes directly brings up a separate editor (e.g., for a style it's the Styles Editor) which lets you reconfigure the code's formatting -- and it will instantly apply your changes wherever that code appears in the dociument.
Other word processors (e.g., Microsoft Word) use a different technique, which results in hiding the items actually responsibile for formatting.
Once you learn the usefulness of Reveal Codes you'll probably never want to be without it.
Tips and tricks
☼ Open or close Reveal Codes with Alt+F3, or use View, Reveal Codes
Hint: You can click on a small (unnamed) bar at the very bottom of the program's vertical scroll bar, just under the Next Page button. Hover your cursor on it and it changes to a two-headed arrow. Click it and the Reveal Codes window should toggle on or off. If dragged up or down, the same button can expand or shrink the window (or use the next tip below).
New with WordPerfect X8: The "small (unnamed) bar" is now a button:
☼ Expand or shrink the Reveal Codes window
When Reveal Codes is open you can place your mouse cursor on the horizontal divider between the document and the Reveal Codes window pane, and then left-click on the divider and drag it up or down. [See also "To customize the display of Reveal Codes" for some more tips.]
☼ Moving around in -- and with -- Reveal Codes
With Reveal Codes open you can click inside it to position the red block cursor █ (representing the actual insertion point in the main document window) just as you can position the cursor in the main document window.
This cursor should also move in lock-step with the one in the main document: move one with mouse or keys and you move the other.
You can move the red block cursor with your keyboard's arrow (◄ ►) keys, too. (In fact, Shift+arrow is a very handy way to select individual codes and characters in Reveal Codes to copy them.)
¤ When you use the keyboard to move the cursor with Reveal Codes open, the cursor will treat many format codes as though they are characters and thus it will require extra keystrokes to move the cursor beyond them. Even with Reveal Codes closed, it can sometimes take an extra keystroke or two to move the cursor (e.g., moving past a cell boundary in a table). This sometimes alarms users that something is wrong with the keyboard. Open Reveal Codes to see what is happening at that location.
¤ It can also be easier to accidentally delete format codes when Reveal Codes is open: See "Deleting..." below.
☼ Finding (most) codes in your document with Find and Replace
The Edit, Find and Replace dialog has both a Match, Codes and a Replace, Codes option for the Find and Replace fields respectively. (You might have to scroll down the lists to find some codes.)
Codes can be inserted into those fields using the appropriate option. Alternatively they can be carefully selected in the document itself (via Reveal Codes), then copied and pasted into those fields.
Note that Find and Replace cannot find codes inside certain other codes, such as those inside [Style] codes or [Delay] codes, as noted below.
See WordPerfect's Help <F1> for more information. Also see the tips here.
☼ Show more information about codes in the Reveal Codes window
• Use arrow keys to place your cursor -- it will appear as a red vertical bar or "box" like this █ -- in front of (i.e., to the left side of) a code to see more information about that code (if more is available).
• Or: Hovering your mouse cursor briefly on a code (then moving it slightly if necessary) will show the information. [Thanks to Gordon McComb for this tip.]
• Or: You can also set the program to always display more detail for many of the codes in Reveal Codes, as noted in a tip below.
There are some additional references on the Internet about the meaning of WordPerfect format codes: See the left sidebar.
☼ Codes in the "stream"
The placement of format codes in relation to other items in the document determines the formatting in the document.
Metaphorically speaking, WordPerfect "reads" these codes and text characters from left to right -- right being "downstream" from the codes/text to the left/above.
This process begins with the basic formatting passed on to the document from the template that spawned it and with any special formatting contained in the document's initial [Open Style: DocumentStyle] code (see here). Then it reads and follows the format "instructions" in any other format codes you (or the program) placed in the document.
[From the Templates page:]
"The main thing to keep in mind here is that, unlike some other word processors, WordPerfect is a "stream oriented" program, where format codes take effect until they are either discontinued (i.e., stopped or suppressed by user intervention) or replaced by another code of the same type (e.g., a new text color).
Hence, new formatting applied in the document is downstream from previous formatting and upstream from other (potential changes in) formatting.
It is the way we type (or dictate, or assemble) material into a document: There is a stream of information with a beginning and end. Occasionally we give the computer an instruction to change the appearance of something in the stream -- like hitting the Caps Lock key to emphasize letters as we type them. Format codes do the same thing.
Note especially that single format codes can be inserted into the stream of text and they will affect subsequent, downstream text; or, if you select text first, they will bracket the selection with a pair of codes -- one to start the formatting and one to stop it -- and the formatting will apply to just that selection.
This simple "stream" metaphor can help you produce complex or creative formatting -- sometimes with things beyond what other word processors allow -- but it can also help solve many format problems, too."
☼ For documents containing changes in formatting that are assembled manually (e.g., with Insert, File or copy-and-paste) or "assembled" using the Subdocument feature or with a multi-page merge, you might want to be sure to explicitly set each document's basic format -- or in the case of merging, your merge form's basic format and pagination codes -- at the top of each assembled document or at the top of the merge form document (.frm). For the general method see here.
☼ Most format codes are placed at, or adjacent to, the current cursor location, such as when you apply the bold attribute to a word or phrase. But WordPerfect automatically places some codes where they most logically should go (such as the top of the current paragraph or page). So you might want to scroll up to the top of the paragraph -- or even to the top of the page -- to see if there are codes that might be impacting the formatting at the current cursor location.
☼ Inserting or deleting material above format codes in the document can cause some codes to move downward or upward.
In most cases this is not a problem but sometimes this can be disconcerting if some items -- such as graphic or text boxes, margin reset settings, formatting Delay codes, etc. -- seems to be misplaced after such editing. [See for example, "Attaching graphic images..." here for some solutions relating to graphic or text boxes.]
The primary solution is to use Reveal Codes to see if misplaced single codes can be relocated (see "Copying, relocating..." below). If not, you can always delete them or temporarily relocate them to another document (e.g., a new blank document) and reformat the relevant section of the current document.
☼ The importance of the first (i.e., beginning) code in a WordPerfect document
Templates set up a special, initial style code in new documemts that acts as a "container" that passes various design elements "downstream" to the new documents when they are created. This initial style code, [Open Style: DocumentStyle], is visible at the very top of the new document in Reveal Codes, and it will remain present for as long as the document exists. (It cannot normally be deleted; however, if it is not present, see here.)
This initial style code is the vehicle that transports whatever other styles or format elements you wish to pass on to the downstream text in new documents based on that template. Typically these include a default font and font size, and default margin settings. The format items inside this code can be easily modified (more here).
☼ Types of codes: single, paired, and hidden
As noted above, format codes can be single (a.k.a. "document", or "open") or paired (such as used with certain style codes). The former remain in effect until replaced by another style code (if any). The latter apply to selected text or to paragraphs. [See the Styles page for more information.]
Codes can even be hidden inside certain other codes -- e.g., inside a [Style] code, such as inside the initial style code discussed above, or inside a [Delay] code, as discussed in the next tips.
Generally, you can double-click on a format code in Reveal Codes to open its Styles Editor to make changes to it. (See "Modifying a code" below.)
Tips and notes about Delay codes
Sometimes manual formatting -- or even some automatic formatting -- causes the program to insert a [Delay] code in the document, usually to delay the onset of certain formatting by one or more pages.
This might be deliberate on your part, such as to delay a margin change until the next page. (To manually insert a [Delay] code, use Format, Page, Delay Codes.) Or it can be automatic, if the program thinks the onset of certain formatting should be delayed a page (or more).
These [Delay] codes also act like little containers for other format codes, and as such they can hide the codes that might be causing a format problem. You can double-click on the [Delay] code to view what is inside it.
Delay codes are actually made up of two codes:
The first [Delay] code tells WordPerfect what to do; the second [Delay Codes] code appears on the (delayed) page and tells WordPerfect where to start doing it.
Double-click on the first code of the pair to open the Define Delay Codes window (this name is displayed at the very top of the WordPerfect main window). It should show the codes inside it in the Reveal Codes window.
(Note also the special toolbar that should be displayed (e.g., see the Delay codes page here), which lets you (a) insert an image, (b) set the page size, or (c) insert a header, footer and/or watermark. These buttons open yet another window inside the Define Delayed Codes window, so you will need to close each in reverse order to return to your document.)
☼ Deleting or replacing a code
• Deleting a SINGLE code can be done in the Reveal Codes window by clicking inside the window to locate your cursor, and then using either the <Delete> or <Backspace> key depending on which side of the code the cursor is on -- or by simply dragging the code from the Reveal Codes window.
There is an exception to this: You cannot manually delete the initial Open style code in a document (discussed above).
Also remember that some codes can be hidden inside other codes (see above, especially about Delay codes). The latter codes act as little containers, so deleting the container deletes any codes inside it.
• Deleting PAIRED codesis similar. However, with paired codes, deleting either the first code or the last code of the pair will immediately delete the other code in that pair. (Remember that paired codes can be separated by quite a lot of text or other material -- even other codes -- so you might want to identify both parts of the pair before deleting either one of its codes.)
• You can usually RESTORE a deleted code during the WordPerfect session with either Edit, Undo or with <Ctrl+Z>.
• Note this caution from the "Cracking the codes..." book above:
"... When the Reveal Codes window is NOT displayed, WordPerfect skips most codes when you press the Delete or Backspace keys so that you don't delete codes by accident. When the codes are revealed, however, WordPerfect figures that you can see what you are doing, and when you press Delete, it deletes the code to the right of the red cursor.
Save your document (press Ctrl+S) before you make any changes in codes because it's easy to make a horrendous mess with this code stuff. If you save your document before you goof up, you can just close the messy version (press Ctrl+F4) and reopen the original (press Ctrl+O) to start fresh.
Your trusty friend Undo (Ctrl+Z) works when you make changes to Reveal Codes as well."
See also -
"Moving around ... in Reveal Codes" above, and
"Should you keep Reveal Codes open all the time?" below.
• Delete ALL codes in the document:
▸ Select - Copy - Paste as Unformatted text:
If you want to strip out all format codes from the current document -- or just from a current selection of material -- to produce "pure text," first copy the selected text to the Windows clipboard (Ctrl+C), then immediately paste the copied text back in place with Edit, Paste Special, Unformatted text. (Tip: Newer versions of WordPerfect have this Paste Unformatted Text choice on the context menu that pops up with a right-click of your mouse.)
▸ Save the document as ANSI Windows text:
Simply use File, Save As and choose (under File Type on that dialog) ANSI Windows Text. Then close the document and re-open it. All formatting codes should be gone, leaving just plain text characters.
▸ A note of caution:
Be aware that deleting format codes -- if applied globally to the entire document -- can remove or change some format codes you might wish to retain, such as headers, footers, footnotes, endnotes, overstrike codes, (some) symbols, hidden text, delay codes, and (in WordPerfect 11 and later versions) they change hard spaces to soft spaces, regular hyphens to hard hyphens, and remove soft hyphens.
This is where careful human editing can become important. (For more details on Edit, Paste Special, Unformatted Text see here.)
Still, they can be a useful techniques, especially to convert (selected) outlines and numbered or bulleted lists to their plain-text versions, remove unwanted codes brought in when copying/pasting from another program or the Internet, etc.
• Delete just SOME codes wherever they appear in the document:
See the DelCodes macros which let you specify the types of code to delete.
• Change format codes into plain text "markers":
See the Code2Txt macro. For example you can change [Bold]text[Bold] to <B>text</B> or similar.
• Replace or augment specified format codes with other format codes:
You can download and use Replace Codes - Plus by Ron Hirsch. (Free to use; very useful and very popular.) His macro can also -
- replace codes wherever found with other codes (e.g., replace underlines with italics).
- augment codes (e.g., change bold text to bold italicized text);
- delete specified codes and their underlying text (e.g., delete redlined draft material);
- change an applied text attribute (e.g., bold) to a more complex character style for convenient use (and easy modifications later).
• Replace one [Style] code with another: See the ReplStyle macro.
☼ Modifying a code
You can double click on a code in Reveal Codes to bring up the same dialog box that (probably) was used to create the code at that location.
When you make changes to the code and return to the document's editing screen, WordPerfect updates the code there. [Or, in the case of some codes -- such as certain automatically updating Paragraph Style codes -- it can immediately update all instances of the code in the document.]
☼ Copying, relocating (moving), or reusing codes in other documents
With Reveal Codes open you can select single formatting codes (with or without adjacent text or other material); then you can copy the selection to the Windows clipboard with <Ctrl+C>, and then paste (Ctrl+V) the material into another location -- or even into another document.
For example, you could select/copy/paste the code that defines a custom watermark for use in another document.
Again, note that this applies to single codes, not paired codes. (See above for more on single and paired codes.)
▸ To select just the code(s) it might help to use <Shift+arrow>, which can be a bit easier and more precise.
▸ To move a code to another location or document you can cut it with <Ctrl+X> instead of copying it before pasting it elsewhere.
▸ To reuse ("repurpose") a code somewhere else in the future, you can turn the selected code into a QuickWord, which is stored in its own special program file. Note that this is probably worthwhile mainly for complex format codes (e.g., headers, footers, watermarks, tab sets, custom table codes, custom styles, etc.), since it is usually easier -- and sometimes more reliable -- to apply new formatting directly into the document you are working on.
☼ Should you keep Reveal Codes open all the time?
The basic answer is that it's a matter of personal preference whether it's open ("on") or closed ("off") -- at least while editing a document. But for macro operations see the note just below.
Many people. including this author, prefer to keep it open during editing so they can check on formatting if necessary.
You can always toggle it open/closed with <Alt+F3>.
¤ See "Deleting or replacing a code" above for some cautions when Reveal Codes is open.
¤ On the other hand, a good reason to keep Reveal Codes open is that some macros that move the cursor item by item (i.e., move past both individual characters and/or format codes) assume that Reveal Codes is open during the macro's execution. If a macro doesn't seem to work properly, try opening Reveal Codes. In fact, macro writers probably should always add code to their macros to temporarily open Reveal Codes whenever the cursor is required to move item by item during macro operation. See Footnote 1 below for some code snippets to do this.
☼ Microsoft Word users (and WordPerfect newbies):
Tips on applying fonts and other formatting to a WordPerfect document -- see here about single codes, paired codes, the "WordPerfect stream," and other topics.
☼ Other tips [from WordPerfect X6's Help Topics:]
• To customize the display of Reveal Codes -
1. Click Tools > Settings.
2. Click Display.
3. Click the Reveal Codes tab.
4. In the Format area, enable or disable any of the following check boxes:
• Wrap lines at window — to continue codes on the next line
• Show spaces as bullets — to display a bullet for each space character
• Show codes in detail — to display formatting information with codes
• Auto-display codes in Go to dialog — to display the Reveal Codes window when a code match is found in a specific section of the document
You can also
- Change the font: Click Font, and choose a font from the Face list box.
- Change the font size: Choose a font size from the Size list box.
- Change the font color: In the Color area, disable the Use system colors check box. Open the Text color flyout, and click a color.
- Change the background color: In the Color area, disable the Use system colors check box. Open the Background color flyout, and click a color.
- Use Windows system colors: In the Color area, enable the Use system colors check box.
• To print the codes in a document -
[N.B.: This feature is not present in WordPerfect 10 and earlier versions.]
1. Click File > Print.
2. Click the Advanced tab.
3. In the Advanced options area, enable the Print Reveal Codes check box.
Note: When you print codes in a document, the printed document does not contain any information other than the codes and the text. For example, graphics and file information are not printed.
• For descriptions of format codes see the resources in the left sidebar.
[...Continued from "Should you keep Reveal Codes open all the time?" above...]
More about setting (and resetting) the current state of Reveal Codes in a macro
• Background and simple solutions
Many macros need to have Reveal Codes open during macro execution. For example, if a macro must find, skip over, or delete format codes, or determine the position the cursor relative to a code, Reveal Codes must be open.
A very simple way to do this in the macro's code is to use something like the following code [or something like Kenneth's code in this post or Jim Shackleford's post]. It turns Reveal Codes on if it is not already on, then resets the original state of Reveal Codes (on or off) as it exits.
[See also an alternative using the WP51CursorMovement command below.]
// Put this segment at the top of the
// macro code (after any Application command):
vRevCodeState = ?RevealCodesActive // Store the current state of RC...
If (Not ?RevealCodesActive) // If RC is not open...
RevealCodes (On!) // ...open the RC window
// ...Main part of macro goes here...
// Put this segment at the end or
// wherever the macro might exit:
If (Not vRevCodeState)
• Problems with Reveal Codes some versions of WordPerfect for Windows
However, in past years I have found the following complications.
1. Reveal Codes cannot be turned on in some early versions of WordPerfect (e.g., WP9) if the View menu choice is set to, say, "Two Page." Thus, macros which might be used in any WordPerfect version should first turn Page View on before turning Reveal Codes on; later, before it terminates, it should automatically reset the View (technically, the "display mode") to what it was before the macro started.
2. A macro cannot set the View if the cursor is located inside a "substructure" -- that is, if it is inside a header, footer, footnote, endnote, text box, etc. (This is true even if you try to use the View menu manually.) Thus, the macro should first exit from any substructure before adjusting the View and turning Reveal Codes on, and then return to the previous cursor location inside the substructure.
• A macro solution that can be used with all versions of WordPerfect for Windows
The following code deals with the above issues when the code sets Reveal Codes "on" (if it was not already on) and then, before the macro terminates, when it resets Reveal Codes to the state it was in before the macro was played. In other words, it restores the user's current setting to what it was before the macro was played.
[To copy this code into your WordPerfect program to create a working macro, see here. Note that this example macro will simply display a message, but you can use the rest of the code in any macro to set (i.e., open) and then reset Reveal Codes.]
// Reveal Codes Toggle.wcm by Barry MacDonnell.
// Lines beginning with double slash marks (//) are
// comments and can be deleted.
// Blue comments are your "how to" instructions.
// STEP 1
// Put this Call() command at the top of the macro or
// where the macro begins its processing:
// STEP 2
// Main macro code routines go here:
// Simple example:
Messagebox(;;"Reveal Codes = On and View = Page")
// STEP 3
// Macro exits here:
// Put this Call() command at any place where the macro
// might exit; it restores RC to the original state (On or
// Off) and also restores the original View (i.e., Display)
// mode :
Return // (or use Quit)
// STEP 4
// Put the entire section below at the end of the macro
// along with any other called routines, functions, or
// other procedures:
// (This segment is called from the top of a macro:)
// [Checks to see whether Reveal Codes is on; it should be on
// while the macro plays and the View should be set to Page.]
// First, if inside a substructure, mark the current location and
// then exit from the substructure(s):
pExitSubstructures () // <- Calls the Procedure() below
// Then get the current View (Draft, Page, Two pages, etc.):
// Set the View to Page mode ("2"=Draft; "3"=Page; note that in
// some WP versions the Command syntax's help file shows "4"
// for Two Page View, even though it is really "5"):
If(?DisplayMode <> 3) ViewPage Endif
// Get the current state of Reveal Codes:
// Turn Reveal Codes on if it is not already on:
If(Not ?RevealCodesActive) RevealCodes(On!) Endif
// Go back to original cursor location; delete temporary bookmark:
// This segment is called at any point where the macro exits:
// Reset the state of Reveal Codes and user's View setting:
If (Not vRevCodeState) RevealCodes(Off!) EndIf
// Then, if inside a substructure, mark current location,
// then exit from the substructure(s):
pExitSubstructures () // <- Calls the Procedure() below
// Reset user's display mode (see View menu):
// (Note: Web Page view in WP8/9: Since there is no 'ViewWebPage'
// macro command in WP8/9, get the user's WP version number and
// restore the view to Page)
If((vDispMode=1 and vWP<=8) or (vDispMode=4 and vWP=9))
If(vDispMode=2) ViewDraft Endif
If(vDispMode=3) ViewPage Endif
If((vDispMode=4 and vWP<=8) or (vDispMode=5 and vWP>8))
// Go back to the original cursor location; delete temporary bookmark:
// (The next Procedure can be used standalone in other macros)
// Exit from any header, footer, footnote, endnote, text box, etc.:
Procedure pExitSubstructures ()
If ((vSubDoc=10) or (vSubDoc=11))
// If cursor is inside an image or a text box is selected, exit from it:
If (vBoxType=1 or vBoxType=3) BoxEnd (Save!) Endif
// *** End of code snippet ***
The last Procedure (i.e., pExitSubstructures) is very helpful in many other macros whenever forcing an exit from a substructure is required.
• Alternative to the macro solutions above
See the macro commands, WP51CursorMovement(On!) and WP51CursorMovement(Off!). For some macros these can work well. WP51CursorMovement(On!) is usually placed at the top of the macro and WP51CursorMovement(Off!) is placed wherever the macro can exit.
Macro writers who might want more detailed information can view Noal Melltott's test of this command on WordPerfect Universe here. Also from Noal:
"To its disadvantage, WP51CursorMovement(On!) does not do away with the message about confirming deletions [set via Tools, Settings, Environment, Prompts tab] as does turning RevealCodes on. Furthermore, when on, it keeps some macro commands, such as PosLineVeryEnd(), from moving beyond any attribute code at the end of the line!"
Hence, the Reveal Codes Toggle macro snippet above may be more generally reliable. But the decision rests on exactly what the macro is designed to do.