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-2012 by Barry MacDonnell. All Rights Reserved.

Page updated May 22, 2012
WordPerfect Tips
Main tips page | Browse tips

Styles

More pages about Styles
on this site -

Custom styles - Creating custom styles; Saving custom styles to your default (or other) template; Retrieving custom (user) styles from another document or template; How to remove the new style from the default template

Mark a custom style for automatic inclusion in a Table of Contents

Replace one style with another, or remove a style's codes

Block protect paragraph styles (e.g., "Heading 2") and following body text

Using, creating, and modifying Outline styles

Automatic paragraph numbering, outlines, and numbered lists

Automatically numbered document headings

Adding emphasis to text:
How to create custom paragraph/page border or fill styles

How to create a Question-and-Answer style

Insert identical text in several locations (Note: WordPerfect 10 can do this with its new 'text variables' feature)

Alternative heading styles - A "Stepped" style; Legal-number-style headings and other automatically numbered headings; using the Columns feature

Also see the examples under "Tips" in the right column, which show how to create custom styles.

 

About styles ...

Styles are design elements -- such as bold, italics, extra large, or colored text -- that can be applied to text. Once created (and saved) they can be reused in other documents by simply selecting some text and applying the style by choosing it from the "Select Style" drop list on the text property bar, or with Format, Styles...Insert.

Some "WordPerfectionists" never use styles, preferring to directly control formatting in the text itself, where all format codes are clearly visible in Reveal Codes. [See Footnote 1.] Since WordPerfect is a "stream oriented" program, where codes take effect until discontinued, replaced, or removed by another code, this makes some sense. You can see (in Reveal Codes) just what is happening with formatting by looking for various On and Off codes for a particular format to verify where a style begins and ends, or to check problems with overlapping or competing codes.

Styles are special format codes that act like containers: They usually hold several formatting codes, but they can even hold text (but see Footnote 2), graphical items, tables, watermarks, and other styles ("nested" styles). Moreover, the items inside a style code are relatively immune from global operations (such as Find and Replace) and casual user editing or accidental deletion.

Styles are easy to create, edit, or import from other documents. They are very easy to apply to text in your document, and may be suited for a variety of tasks. They can give a consistent look to the document, and they have the big advantage of being globally changed simply by editing any single instance of a particular style in a document. (This requires that a checkbox, "Automatically update style when changed in document," be enabled in the Styles Editor for that style. Of course, if you share the document with others, let them know about this setting or they might be surprised to see global changes when none were expected!)

Even some things we tend to think of in WordPerfect as separate features are in fact a type of style: Headers, footers, watermarks, footnotes, endnotes, outlines, comments, etc. -- all are built-in styles!

Types of styles

There are three general types of WordPerfect text styles:

    • Character -- typically these are applied to selected text (i.e., text you first select with mouse or keyboard), and are usually limited to applying a different font or combination of font attributes (bold, underline, color, etc.). They will override any Paragraph styles that might be applied at the current cursor location.
    • Paragraph -- these affect entire paragraphs (up to the point where you press <Enter>); typically, you use them for headings, titles, outlines, etc. They will override the DocumentStyle settings or other formatting.
      • Because short text phrases are often used as headings or section titles, WordPerfect comes with several standard Paragraph styles (Heading 1 through Heading 5), available from the drop list on the Text property bar. They are also set up ("marked") to be included in a Table of Contents.
    • Document (a/k/a "Open") -- applies to all text in a document from the cursor location forward until another style is encountered (if any).
      • The initial style at the very top of a document ([Open Style: DocumentStyle]) is a Document style; it is inherited from the template that spawned your document, and it sets up initial formatting for the document. This style can be edited to modify it by double clicking its code in Reveal Codes, as explained here.

Note that the type of style in effect in a document -- Character, Paragraph, or Document -- should be visible on the code itself in Reveal Codes. Just pass your cursor over the code.

It is also important to note that the first two style types -- Character and Paragraph -- are paired-code styles. The pair of codes -- an On code and an Off code -- that makes up the style "brackets" the intervening text (you can see them in Reveal Codes). If you delete either one of the pair of codes, you will delete both codes. However, Document styles are produced by a single code that remains in effect until replaced by another style.

Tips

    • Basic steps to create a style [see also the Examples below]: 
      • Click Format, Styles. 
      • Click Create to bring up the Styles Editor.
      • In the Styles Editor, type a name for the style in the Style name box (12 characters maximum). Give each style a unique name to prevent replacing existing styles that have the same name. 
      • Type a description for the style in the Description box.
      • Choose a style from the Type list box. [N.B.: See Types of Styles above.]
      • Using the Styles Editor's toolbar and menu bar, apply any style attributes such as Bold, Italics, etc.
      • If you want to define what function the Enter key performs when the style is applied, choose a style from the "Enter key inserts style" list box; otherwise, leave it set to <None>.
      • If you want to display the codes that take effect when a style ends, enable the Show ‘off codes’ check box. 
      • Click OK twice to return to the document. The new style will appear in the Select Style list on the text property bar.
    • For more on creating, modifying, and saving custom styles see Custom Styles.
    • See also "Creating or modifying outline styles." (WordPerfect outlines are a form of Paragraph style.)
    • You can also create a style quickly by using QuickStyle. See WordPerfect's online Help [the <F1> key] or click here.
    • For temporary work -- i.e., copy the format of text and apply it elsewhere in the document -- you can use QuickFormat. See WordPerfect's online Help [the <F1> key] or click here.
    • You can quickly edit (i.e., change) an existing style in the current document by double-clicking the [Style] code in Reveal Codes. The Styles Editor that appears has a menu and toolbar which you can use to add format codes to the Contents pane in the Styles Editor. The changes made this way will be stored in the current document. The information here on creating a style should help you with editing a style.
    • If you have applied a Character or Paragraph style to some text (which, as noted in the previous section, are paired-code styles) and "Automatically update style when changed in document" is enabled in the Styles Editor for that style, you can change the formatting of a portion of the text to which the style was applied by selecting that portion of text first, then apply the formatting (e.g., italics). On the other hand, applying the formatting first (e.g., by using Ctrl+I) will tell WordPerfect to apply it to the entire style's text by adding the new formatting code inside the [Style] code. (You can edit the style to remove this formatting. See the previous tip.)
    • If you click Format, Style, then select a custom style, then click Options, Delete ... you can choose to "Leave formatting codes in document." This is an easy way to convert a custom style into normal formatting codes. (You can't do this with standard "shipping" styles.) N.B.: If you have duplicate style names in the list, you should delete the style stored in the current document, not the template. (The location -- current document or template -- of each style is shown on the right side of the Styles dialog.)
      • Here's a three-line macro that will do the job. Be sure to change "MyCustomStyle" below to the name of your actual custom style (but retain the quote marks). Note that the code redirects the macro to a Label() if the style does not exist. (To copy macro code here into WordPerfect, see CopyCode.html.)
      • OnError(End@)
        StyleDelete (Style: "MyCustomStyle"; Codes: LeavingCodes!; Library: CurrentDoc!)
        Label(End@)
    • By default, customized styles are saved with the current document, but you can also save them to your default template or other template so that they will available for all new documents based on those templates. You can also copy styles from one document to another. See here.
    • Other references:
      • A good, basic introduction to styles can be found in Laura Acklen's Absolute Beginner's Guide to WordPerfect 12 (or other version), which is inexpensive and can be found on Amazon.com or other bookseller.
      • A more comprehensive guide is Laura Acklen and Read Gilgen's Special Edition: Using WordPerfect 12 (or other version).
      • Both books are published by QUE. See the direct links on this site's Home page.
Example 1:  
Create a custom style to automatically convert selected text to UPPER case

(See also Footnote 3)

To give you an idea of how easy it is to create a custom style, let's suppose you want to create a style that turns all selected text into UPPER CASE (a/k/a capital letters) because WordPerfect has no direct way to do this except by selecting some text and clicking Edit, Convert Case. UPPERCASE.

You simply create a style that uses both Small Caps and Large size. Then you can apply this custom style to text that is all lower case. This should give you something similar to all upper case for most fonts and typical sizes.

    • Click Format, Styles, Create.
    • In the "Style name:" field, give the style a name.
    • Add a description if desired in the next field.
    • In the "Enter key inserts style:" field, select <None>.
      • Note: This field lets you choose another style to become active when the Enter key is pressed; here, you most likely want normal body text to become active, so <None> will default to your body text style. If you select <Same Style>, WordPerfect will continue applying the same style to the next paragraphs -- that is, the text following a press of the Enter key -- until you deliberately choose another style from the Select Style list on the Text property bar (or from Format, Styles).
    • In the "Type:" field, select Paragraph for headings and other single paragraph types of text, or select Character if you want to apply the style to a word or a few phrases (then, after applying the style, press the right arrow key to skip past the "ending" style code and resume typing normal text). If you select Document (open), the style will be used until you deliberately select another style or choose until you choose <None> from the Select Style list.
    • In WordPerfect 9 and later, check the box, "Automatically update style..." if you want all instances of the style in the document to change if you change any single instance of the style's formatting. (Most people probably want this to happen.) In WordPerfect 8 and earlier, you will not see this checkbox; rather, use the "paired-auto" version of the style in the Type field.
    • Put the cursor in the "Contents:" field (or "pane"). This is where the actual style's formatting codes (and any text characters) are stored. (See also "Tricking WordPerfect" in the next example below.)
      • From the Styles Editor's menu at the top of the dialog, click Format, Font, and check the Small caps box; then click the Relative size button and choose Large. This inserts two format codes in the Contents field.
      • Note the "Show 'off codes'" checkbox: If you enable it you will see a long, "text placeholder" code appear:
        • [Codes to the left are ON - Codes to the right are OFF]
      • This code can be selected (it's easier to use <Shift> plus an arrow key) and a paired format code applied to the code itself, such as relative size codes, bold or italic codes, etc. This tells WordPerfect to apply the format to everything in the paragraph, then discontinue it (turn it off) immediately following the end of the paragraph. [For a good example of this, see "Mark a custom style for inclusion in a Table of Contents.] You can also add some codes before and after this long code without selecting it first, to turn certain formatting on and then change it back (e.g., change from one line spacing back to another spacing).
      • If you are creating a Character style (see above), you don't need to select this special [Codes to the left...] code. Just use the Editor's menu or toolbar to add the format code(s) to the left of the [Codes to the left...] code (assuming it is visible in the Contents pane).
      • You can add text characters, such as a colon (:), following (to the right of) the [Codes to the left...] code. This will add the colon automatically to any body text to which you have applied the style.
    • Click OK twice to return to the document. The new style will appear in the Select Style list on the text property bar.

Apply the new style to some selected text. It you created a Paragraph style, the style will stop with the next paragraph. If you created a Character style, you can insert the style and then start typing in lower case (when finished, press the right arrow key once to skip past the style code), or type the text, select it, and then apply the Character style. You can re-edit the style by double clicking its [Style] code in Reveal Codes.

The main virtue of this example -- and all Paragraph and Character styles -- is that if you enabled "Automatically update style..." you can change any one instance of the style's formatting and all instances will change in the current document. This makes it very easy to instantly "tweak" the style's text throughout a long document. [Tip: If you share the document with other WordPerfect users, be sure to tell them about this feature so they won't be surprised when they change one item only to find all similar ones change, too.]

Tips

Example 2:
Tricking WordPerfect
    • Some things cannot be inserted in the Styles Editor's Contents pane from the Styles Editor's menu or toolbar. However, you can create them in the document itself and then copy them from the document into the Contents pane. For example, if you want to delay margin settings (or other formatting) to the second and subsequent pages, you can use a [Delay] code on the first page, then copy that code into the initial Document Style, where it will be hidden from view and less likely to be accidentally deleted. See here for instructions.
    • Some custom style formats are difficult to create just by using WordPerfect's QuickStyle (Format, Styles, QuickStyle). For example, setting up a custom paragraph style (see basic steps in the preceding section) that makes all text in the paragraph (or selected paragraphs) relatively smaller (or larger) will probably require you to edit the custom paragraph style (Format, Styles, <style name>, Edit) and add the paired codes for relative size around the built-in single "placeholder" code you will see when you enable the box "Show 'off codes'" in the Styles Editor. (This single code shows up as "Codes to the left are ON - Codes to the right are OFF" in the Styles Editor's Contents field.)
            In the current example, you would select this single "Codes to the left ..." code (with <Shift+right arrow>) in the Contents field and then click Format, Font, Relative size, and choose a relative size to apply. The "Codes to the left..." code will then be bracketed by the paired relative size codes -- which in effect means that the paragraph (or selected paragraphs) will be sized smaller (or larger) when the style is applied to paragraphs.
             For another example of this technique, see Mark a custom style for automatic inclusion in a Table of Contents, which brackets this code with paired Table of Contents codes.
             Note that you can select and bracket the "Codes to the left ..." code with any paired formatting codes using the Styles Editor's own Format menu, such as italics or a new font. You can also add an Indent or Tab code at the beginning of the string of codes.
Advanced example:
Create a style using a macro

Here is a Character style (i.e., one that applies formatting from the current cursor location onward) that a user requested on WordPerfect Universe. It can be used to deploy a custom style on multiple machines, or just apply a custom style when needed by assigning it to a toolbar, menu, or keystroke. (To copy macro code here into WordPerfect, see CopyCode.html.)

Notes

Since WordPerfect 9 was released, you cannot record a style, you have to code it manually. I cheated: I used WP8 to record things and then edited the results.

The macro code below creates a style -- named here "SampleStyle" -- that applies Arial Black 10-point font, underlining, and red coloring to all text following the cursor location. It also creates the style in the current document only. You will want to change these parameters in your own macro. The items to change are indicated in dark red.

If you want the user to see what's going on in the document, you can force Reveal Codes "on" by using the RevealCodes(On!) command just above the rest of the commands below.

Macro writers can insert a style into a document's (or template's) initial style with a macro. See here for an example.

(To copy macro code here into WordPerfect, see CopyCode.html.)

// All commands should be on their own lines without line breaks inside them:

StyleCreate (Name: "SampleStyle"; Type: AutoCharacterStyle!; Library: CurrentDoc!)
StyleEditBegin (Style: "
SampleStyle"; Library: CurrentDoc!)
StyleDescription (Description: "
Sample character style")
StyleCodes (State: WithOffCodes!; Library:
CurrentDoc!)
StyleEnterKeySetting (Action: StyleOff!)
Font ("
Arial Black Regular")
FontSize (
10p)
AttributeAppearanceToggle (Attrib: Underline!)
TextColor (Red: 255; Green: 0; Blue: 0)

SubstructureExit ()
StyleEditEnd (State: Save!)

// If you want to immediately apply the style (otherwise delete the next line):
StyleOn ("
SampleStyle")



Footnote 1

One of the big advantages of WordPerfect compared to Microsoft Word is that you don't need styles in WordPerfect. As Seth Katz said in a post on WordPerfect Universe:

"... It's fine to depend on styles when you yourself created them and know their details. Another person may not, and that person will either have to spend time excavating the document to determine the formatting of each style, or will give up and use direct formatting. If you're a mechanic you could rearrange all the controls and instruments in a car and on the dashboard to make them more efficient; don't expect anyone else to be able to get in and just start driving. Since WordPerfect [unlike Microsoft Word] doesn't depend on styles you can just apply the formatting [in WordPerfect, these are controlled by in-line codes] as the program is designed to do out of the box, and the next person will do the same. ..."

Some Word users might say that WordPerfect codes are a drawback, that they proliferate in a document in a confusing manner. Seth continues:

"The proliferation of codes in WordPerfect is a *FEATURE*, not a bug. Each code is discrete, controlling just one aspect of formatting. Word ... aggregates its formatting because it's part of the object. You can't copy, move or delete just one part of the formatting; it's all or nothing. These discrete codes are why you can search for formatting *CHANGES* in WordPerfect [e.g., with Find and Replace], unlike Word. ...

Actually codes in WordPerfect really don't proliferate, because they don't have to. The stream-based architecture means one code controls that format aspect for all downstream text until superseded by another code. Contrast that with Word, where every character, paragraph and section contains formatting.

The flush-right discussion [about how to create a small bit of text that is flush with the right margin, or mixing text justification on the same line] points out many of Word's shortcomings. Yes, you can do flush-right in Word, but that's not the point. If you had to you could type your document on a typewriter. The point is how easy, fast and convenient it is to do it. In Word, you have to customize to do it by either manually setting a tab stop or including that tab setting in a style. Later, you will not easily be able to tell which method was used. If you include it in a style, you get all the other formatting included in the style, whether you want that or not. You do not know whether it's available unless you look at the ruler or know ahead of time that it's there. If for some reason you don't want it, you have to change the tab setting or revise the style. If you revise the style, that revision takes effect for every other paragraph formatted with that style, whether you want that or not. And it's available only for that particular paragraph or when using that particular style.

One last thing: If reveal codes is so bad, why has Microsoft done everything it can to emulate it?"

Footnote 2

Starting with WordPerfect 10, Corel included Text Variables (Insert, Variable), a form of WordPerfect style that lets you place the same text in multiple document locations. You can include text in any style by editing the style and including text characters along with the style's format codes. However, if you want to convert documents that contain such complex styles to Microsoft Word, you should be aware that, since Word has no comparable feature, the text in the style will be lost after the conversion to Word. Similarly, tabs (but apparently not tab settings) inside WordPerfect styles might be lost, too.

Footnote 3

You can, of course, convert selected text's case with a macro.

For example, here's a macro that will convert the current sentence to all UPPER-case. (To convert just the current word, replace the parameter in the SelectOn command with WordMode!. You can also add other commands immediately after the ConvertCaseUppercase command, such as AttributeRelativeSizeToggle (Size:Small!).)

The first segment of the macro takes into account the possibility that something greater than a sentence might already be selected, such as the current paragraph. In that case, the macro will position the cursor at the beginning of the selected text before processing the text.

To copy macro code here into WordPerfect, see CopyCode.html.

// Convert the current sentence to upper case.wcm

// To convert just the current word, replace the parameter in
// the SelectOn() command with WordMode!

OnError(End@)
If(?BlockActive)
  PosSelectTop
  SelectOff
Endif

SelectOn (SentenceMode!)
PosSelectBottom
ConvertCaseUppercase
SelectOff
Label(End@)

And here's a macro that converts the currently selectred sentence to all lower-case, taking into account the possibility that the first letter of the sentence bight be automatically capitalized by WordPerfect's QuickCorrect Format-As-You-Go feature. Moreover, it takes into account the possibility that (1) something greater than a sentence might already be selected, such as the current paragraph; and (2) the sentence begins with a format code or non-alpha (i.e., not an A-Z or a-z) character. (To copy macro code here into WordPerfect, see CopyCode.html.)

// Convert the current sentence to lower case.wcm

OnError(End@)

// Position the cursor at the top of the selection -
If(?BlockActive)
  PosSelectTop
Else
  SelectOn (SentenceMode!)
  PosSelectTop
Endif
SelectOff

// Move past codes and non-letters until an upper or
// lower alpha text character is reached -
While (?RightCode>0 or
  ((not(CtoN(?RightChar)>64 and CtoN(?RightChar)<91)) and
  (not(CtoN(?RightChar)>96 and CtoN(?RightChar)<123))))
  PosCharNext
EndWhile

// Convert the first alpha character to lower-case -
SelectCharNext
vSel:=ToLower(?SelectedText)
Type(vSel)
PosCharPrevious

// Convert the rest of the sentence -
SelectOn (SentenceMode!)
ConvertCaseLowercase ()
SelectOff
Label(End@)

You could add code immediately after the ConvertCaseLowercase command to change the selected text to all caps, etc. See the ConvertCase and AttributeAppearanceToggle commands.