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 May 24, 2017

WordPerfect Tips
Main tips page | Browse tips

Custom styles -

Creating and applying custom styles

Working with text styles

How to create and apply a new text style (from scratch)

How to create a "QuickStyle"

How to use "QuickFormat"

Editing, modifying, and copying existing styles
Saving custom styles to your default (or other) template

Retrieving custom styles from other documents or templates

Traditional methods

Non-traditional methods
Resetting modified WordPerfect styles to the WordPerfect default

Removing custom styles from a document, custom template, or the default template when you don't need them anymore



Related "styles" pages on this site:

Styles - About styles (types, tips, examples)

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 (Q&A) 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

Graphics tips (many graphics you create or insert are controlled by sytles)

Creating and applying custom text styles

☼  For general information about text styles, with several tips, examples, and links to related pages on this site, see http://wptoolbox.com/tips/Styles.html.

☼  For tips on creating and using outline styles, see http://wptoolbox.com/tips/Outlines.html.

☼  For tips on creating and using graphic styles, see http://wptoolbox.com/tips/GraphicsTips.html.

Working with text styles
What are they?

Basically, styles are collections of formatting attributes that enable you to quickly apply all their formatting at once. They are like little "containers" of format codes (sometimes even including ordinary text characters or symbols).

Text styles can be accessed using the Format, Styles menu choice.

[N.B.: To use or modify outline styles (automatically numbered or lettered or bulleted lines or paragraphs) or graphic styles, see the links in the general tips above.]

For example, WordPerfect ships with various pre-made styles -- including five paragraph heading styles named Heading 1 through Heading 5. When heading styles are applied to text they add various common formatting attributes -- such as large bold centered text -- to the entire paragraph (typically this is a centered title or a short "heading" phrase at the left margin). These five factory-shipped styles have certain other advantages, such as when you set up a Table of Contents (described here).

In addition to accessing these styles with Format, Styles you can quickly access them from the Select Style drop list on the text property bar that should appear when your cursor is in the body text area of the document. Any custom, user-created text styles will appear on that list, too, making it a quick and easy way to apply your favorite styles.

[N.B.: The text property bar normally displays when your cursor is in the body text area of the document. If it does not -- perhaps because you clicked View, Hide Bars -- use View, Toolbars and enable (tick) the "Property Bar" checkbox.]

You can also create and use your own custom text styles, which is the main topic on this page.

Once you create a custom text style ... then what?

•  You can apply the style to [A] selected text, or [B] the next paragraph, or [C] the entire document from the cursor onward (until the style is discontinued or replaced by another style).

This can be done is several ways, but the easiest is to simply use the Select Style list on the text property bar to choose the style you need. Or you can use Format, Styles from the program's main menu.

You can also apply an existing style -- i.e., one that appears in Format, Styles -- with a simple macro: See Step 8 below.
•  Custom styles are saved with the current document, but you can save them for future use as part of a specific template such as the default template.
•  You can also retrieve, copy, edit, and rename a text style, which is useful if you want to create a new style based on the formatting options of an existing style.
•  You can restore a pre-set system (i.e., factory) style, and you can delete any of your user-defined (i.e., custom) styles.

There are three general types of WordPerfect text styles, which differ in how they work.

  Document styles (a.k.a. "Open" styles) apply to all material in a document from the cursor location forward until another style with the same type of formatting (e.g., a new font) is encountered (if any).

[For more on WordPerfect's sequential, or "stream," formatting see here.]

Tips

☼ 
The most common style of this type is the initial style at the very top of a document, visible in Reveal Codes as [Open Style: DocumentStyle]. It sets up default formatting for the document.

Note that this important style can be edited to customize it by double-clicking its code in Reveal Codes.
[For more on setting up initial formatting see "How to set default formatting for new documents: A step-by-step guide" here.]

☼  Open styles have various uses, including at the top of individual documents to easily and quickly add some specific initial document formatting, such as to set up special formatting for a book chapter's body text.

They also can be used to ensure consistent formatting in a file created by adding several documents together (e.g.) with Insert, File, or when linking several "subdocuments" with the Master/Subdocument feature (see tips here). Using a uniquely named custom Open style placed at the top of each of these documents (but not placed inside the initial Open Style: DocumentStyle code) can help "force" uniform formatting. Again, these styles apply to text from the style's location forward unless another style is encountered further in the document that supersedes that style's specific formatting.

  Paragraph styles can be applied to either selected text or at a point where you want to format newly created text, and they will affect entire paragraphs (up to the point where your selection ends or, if you are applying them to new text, to the point where you press <Enter>).

Tips

☼  Here, a "paragraph" is any text that ends with a hard return -- i.e., a [HRt] inserted with the Enter key or with a similar "paragraph-ending" code such as a [Para Style] code.

☼  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.

☼  WordPerfect also has several built-in Outline styles, which are a special form of Paragraph style that produce automatically numbered, lettered, or bulleted paragraphs.

☼  Paragraph styles generally will override the document's default formatting or other open style formatting that might be in effect at the current cursor location.

Exceptions: They won't override the same text attribute (a.k.a. appearance) -- e.g., using bold in the Paragraph style applied to some text won't replace (i.e., reverse) bold in a preceding Open style's text at that location. They also won't override an existing relative font size -- e.g., a large relative size won't replace a small relative stze. However, you can simply select the relevant Paragraph style's text and directly apply the new attribute or relative size (see the Format, Font menu). This should allow you to change the format of the Paragraph style's text directly, even when it is "downstream" from the Open style's text.

  Character styles typically are applied to selected text — i.e., text you first select ("highlight") with your mouse or keyboard — and they are usually limited to applying a different font or a combination of font attibutes (bold, underline, color, etc.). But they can contain other elements such as text characters (e.g., brackets or parentheses).

Tips

☼  If you simply apply a Character style without selecting any text first, the program inserts a pair of On/Off Character style codes at the cursor location, bracketing the insertion cursor. (See tips and notes below.) You can then just start typing and the style will automatically apply to the new material. When finished typing that styled text, press the right arrow key once to skip over the (Off) code of the pair. You then can resume typing with the style in effect before the Character style was applied.

☼  Character styles will generally override any Paragraph styles that might be in effect at the current cursor location. This is one way to apply (e.g.) a new color to selected text at that location.

Exceptions: They won't override the same text attribute (a.k.a. appearance) -- e.g., using italics in the Character style won't replace (i.e., reverse) italics in the Paragraph style's text at that location. They also won't override an existing relative font size -- e.g., a large relative size won't replace a small relative stze. However, you can simply select the relevant Character style's text and directly apply the new attribute or relative size (see the Format, Font menu). This should allow you to change the format of the Character style's text directly, even when it is nested inside a Paragraph style's text.

  Tips and notes
¤  You can also use QuickStyles (see below) to apply a style. QuickStyles are styles created based on the formatting in effect at the current cursor location.

¤  T
he type of style in effect in a document (i.e., Document, Paragraph, or Character) should be visible directly on the code itself in Reveal Codes. Just hover your cursor over the code for a moment or two.

¤  It is important to note a few things about these WordPerfect style codes:
Paragraph styles and Character styles are paired-code styles. The first code in the pair starts the style ("on" code) and the second code stops it ("off" code).

Further, if you open Reveal Codes and delete just one code of the pair, you will delete both codes. (This is actually a handy thing: It saves you from having to search for the second code in order to delete it.)

On the other hand, Document ("Open") styles are produced by a single code that remains in effect until replaced by another style containing the same type of formatting.
How to create and apply a new text style (from scratch)

The information below is not as complicated or time consuming as it might appear. Much of it contains options and tips you might not need at this time; consider them as references for possible future needs.

To modify an existing text style, see below.

To modify outline styles -- which are specially numbered paragraphs -- see the Outlines page here.
Create a new text style from scratch:

Step 1. Click Format, Styles to bring up the Styles dialog.

Styles Editor showing Create button

Step 2. Click the Create button on the Styles dialog. This brings up the Styles Editor dialog.

Styles Editor

Step 3. Type a name for the style in the Style Name field (12 characters maximum).

Give each style a unique name. Here's why:

If you combine documents that contain a style with the same name, only one version of that style will active in the new document; the other will be deleted. If you open an older document or a document from someone else that has a style in it with the same name as one of your styles, your current style will take precedence.

Step 4. Type a brief description for the style in the Description field.

Step 5. Choose a style type from the Type list drop list. By default the Paragraph style is chosen, but you can also choose Character or Document. (See more on the three general types of styles above.)

Step 6. Click in the Contents pane and add your desired formatting to the style:

Using the Styles Editor's own menu and/or property bar (the "toolbar" under the Editor's File...Tools menu), click on the style attributes you want to apply -- e.g., tab (Insert, Tab) or indent (Format, Paragraph, Indent), font, bold, relative size, etc. This puts various format codes into the Styles Editor's Contents pane.

If you want the new formatting to apply to just the text of a Paragraph or Character style and then change to something else immediately following that text, see the tip below about the Editor's option to "Show 'off codes'".

Note
s

¤  Later, you can add or modify these items [i.e., in the Editor's Contents pane] by editing the style.

¤  The Styles Editor's property bar is a "clone" of the program's standard Text property bar. As with any toolbar or property bar, it can be modified to add buttons to it. (See below.)

¤  If you wish to set a specific decimal size for a font (i.e., a fractional font size like 11.5 points) inside the Styles Editor:
See Method B in "Setting decimal font sizes in WordPerfect" here.

Step 7. Do any of the following:

Set up a "chain" of styles:

[These options are inactive if you are creating a Document style (see above).]

Choose an option from the "Enter key inserts style" list box to define what the <Enter> key does when the style is applied.

"<None>" means the style ends when <Enter> is pressed in the document area, and it is a typical choice.

"<Same Style"> means the style "chains to itself," and thus will continue to be applied until you move the cursor past the ending code of the style in Reveal Codes, or you deliberately apply a new style.

You can also select an existing style that should immediately follow (i.e., be chained to) the current style when you press <Enter>. [Example: See "How to create a Question-and-Answer (Q&A) style" here.]

Optionally format subsequent material:

Enable the "Show 'Off Codes'" check box at the bottom of the Styles Editor to display the formatting (codes and even characters) that takes effect at the point where a style ends. (See below for some practical uses for the new, long code that appears when you enable this check box.)

The other checkbox, "Reveal codes," is enabled by default and displays the codes for the style attributes in the Editor's Contents pane. Thus it should be left enabled.

Optionally include text characters, or even styles from other documents:

With the cursor inside the Contents pane of the Styles Editor, you can not only insert format codes from the Styles Editor menu or toolbar, you can also type text characters that will become part of the style. And as discussed in the next item below, you can even select, copy, and paste format codes -- such as other styles -- into the Contents pane from another open document. This also can be done anytime by editing the style.

Tips relating to the Styles Editor:

☼  Copy existing formatting into a style code:

You can also select format codes or text in the body text area of any open document and copy them to the clipboard (<Ctrl+C>) or cut them to the clipboard (<Ctrl+X>). Then paste them (<Ctrl+V>) into the Contents pane of the Styles Editor.

This is most easily done in the source document's Reveal Codes window by using <Shift+arrow> to carefully select just the desired codes and/or text.

Note

This select-copy-paste method is one way (see below for another way) to deal with those circumstances where inserting some codes -- such as [Delay] codes or [Highlight] codes -- into a style cannot be done from the Styles Editor's own menu or toolbar, or when the code doesn't seem to "take" -- such as setting line spacing to "1.0" when the document is already using that spacing (the program is designed to remove unnecessary duplicate codes).

Tip

You can set line spacing to any other amount such as 1.1, then set it back to 1.0 to produce a [LnSpacing:1.0] code in the document. This tips works for other default values such as resetting margins to 1.0" in a document where they are already set to that dimension (see here), or resetting page numbers in multi-page merge documents (see here).

The method is explained in more detail in the article, "Automating WordPerfect Templates" (see "Formatting custom templates," and the tips in that section).

It was also mentioned in a tip from Noal Mellot in a post on WordPerfect Universe:

"
[WordPerfect] styles accept many codes, but some of the more complex codes (table, header, footer, graphic or an open style) cannot be created or edited inside the style itself. They can only be created or edited in the ordinary document screen, whence you can cut and paste them into a style. ... Some codes encapsulated in a style (via the Styles Editor) cannot be modified once there (WP runs a message telling you so [or the program might simply freeze]). In these cases copy such a code back into the document, modify it there and then re-copy it back into the style. For example, you might have trouble editing a header and delay/discontinue codes related to it inside a style. If so, cut the codes out of the style and pasting them in the ordinary document screen. Edit them there and then paste them back into the style."

☼  Automatically update the style:

When you create [or modify] a style you can enable the option in the Styles Editor to have WordPerfect automatically update the style when you change any instance of the applied style.

For example, in the main document you could select the text to which the style was applied and add a blue color to it. All other text in that document to which that style was applied will immediately turn blue.

Note

If you share such a document with other WordPerfect users, be sure to let them know about this feature so they are not surprised or mystified when they apply or change some formatting in text where such a style has been applied. Unless they look in Reveal Codes to see that a style was applied to that text, they might not notice this fact, and format changes they make will be applied to all instances of that style in the document.

☼  Use the special code available inside the Styles Editor to start and stop some formatting:

If the checkbox at the bottom of the Styles Editor labeled "Show 'off codes'" is enabled (ticked), you should see a long code in the Contents pane, "
Codes to the left are ON - Codes to the right are OFF" like this:

Styles Editor with "Show 'off codes'" enabled

This long code is a sort of placeholder for the document text that displays (and prints) when the style is applied to it.

[Note that this code does not appear in a Document ("Open") style since that type of style doesn't contain an "off" code.]

Hence, you can tell WordPerfect to apply formatting from the beginning of selected or chosen text in the document ("on" format codes are placed on the left side of that long code) to the end of the selected or chosen text ("off" codes or replacement codes are often placed on the right side of that long code).

Some Paragraph or Character style formatting does not need to span this long placeholder code for it to apply to just the text the style is applied to. On the other hand paired format codes or begin/end text characters can make good use of this placeholder code to force their on/off actions.

Related tips

☼  To apply paired format codes (e.g., italics,   underlining, etc.), it is easier to use <Shift+arrow> to select this long code, then apply the paired format codes to it (e.g., by using the Editor's property bar to apply italics formatting). On the other hand, single format codes can be directly placed either before or after this long placeholder code, depending on whether they should afftect the style's text or they should follow that text (e.g., a graphic line used to underline the block of text).

☼  To apply single format codes (e.g., a text [Color]), just position the cursor before the placeholder (and another one after it if you want that type of formatting to change to some other value after the style ends, as in the line spacing shown in Example 1 below), and then use either the Editor's menu or its property bar to insert the desired format code.

☼  If the style has been marked inside the Styles Editor with two special format codes for inclusion in a Table of Contents ([Mrk Txt T.O.C.]) see here. Generally, you will want to place any special formatting, text characters and/or symbols outside these two special codes so that they won't also appear in the TOC.

☼  You can also use text characters -- including brackets [], parentheses (), symbols (•), or spaces -- to surround the displayed document text by placing one of them before the placeholder code and the other after the placeholder code.

Example 1: If you have a document with default body text line spacing set to 1.5 lines, and wish to have quotations indented in single-space [screen shot here], you can add a line spacing code after that long code to restore the following line spaces to 1.5 [screen shot here].

Example 2: This long code is useful in "marking" your own custom styles for display in a Table of Contents, reducing the space between paragraph headings and following text, etc.

☼  Use a button from the main toolbar to add other formatting to the style:

While you can usually add a lot of custom formatting to a style using the Styles Editor's own toolbar or menu, some format codes are not available on either its toolbar (a.k.a its property bar) or its menu.

If a desired format choice is not available in the Styles Editor, try using one that might be visible on your main toolbar (or a visible property bar) while the Styles Editor is still open.

Sidebar: The main program toolbars and property bars can be customized with new buttons. See "How to create a toolbar button..." here.

☼  Add a frequently used button to the Styles Editor's toolbar:

If you find a particular program toolbar or property bar button is useful enough to always have available in the Styles Editor you can add it to the toolbar there.

Since the toolbar in the Styles Editor is a "clone" of the program's Text property bar, you could modify the Text property bar (see here) -- or better, simply add a copy of the button on it to the Styles Editor's toolbar, as follows:

To copy a program toolbar button or a property bar button (e.g., the Highlight On/Off button) to the Editor's toolbar, hold down both the <Ctrl> and <Alt> keys while you drag that button from the source toolbar onto the Styles Editor's bar. [Most people probably will want to copy the button, not move it (as would happen with just the <Alt> key), so that the source toolbar remains unmodified.]

To re-position the button, hold down the <Alt> key while you drag the button to a new position.

If you need to delete a button from any toolbar or property bar, simply hold down the <Alt> key and drag the button off the bar.

If the button you need is not visible on the Editor's toolbar, you can use the small arrows on the right side of it to scroll down.

    Step 8. Apply the style in the current document. (If you wish to use the style in other documents, see the important note below.)

    Here's how:

    All users

    You can apply the style at the current cursor location (then type some text) or you can apply it to previously selected text.

    To do so, you can choose the style by from the "Select Style" drop list on the text property bar, or by clicking Format, Styles, <style name>, Insert.

    Tip:

    If you name each style with a different initial letter you can quickly apply the style:

    Call up the Styles dialog with a shortcut key (default = Alt+F8, but you can assign any available keys), then follow the shortcut with the initial letter, then press <Enter> to apply the style at the cursor location.

    Advanced users

    You can write a small macro to apply the style, then assign the macro to a toolbar, keyboard shortcut, or menu (as explained here).

    For example, if the custom style is named MyNewStyle, then use this macro command:

    StyleOn ("MyNewStyle")

    Note that your custom style — such as a Character style — might require you to select text first before applying the style. Hence, a macro like this will check for the existence of a selection of text and warn you if nothing was selected:

    If (Not ?BlockActive)
      Messagebox (;; "Select text first!") Quit
    Else
      StyleOn ("MyNewStyle")
    Endif

    Tip: If you want to apply the style to several words or phrases wherever they appear in the body of the document, see Footnote 2.

    Important 

    By design, custom styles are created only in the current document, which can be a regular WordPerfect document (.wpd) or even a template (.wpt) you opened for editing.

    If you are working in a regular WordPerfect document (.wpd) when you create them, be aware that unless you deliberately save them to the default template or to a custom template or you later retrieve them from the document, they will be available only in the document where they were created. (If they were created in a template document (.wpt), then all new documents spawned by that template will contain them.)

    To save them from the regular WordPerfect document (.wpd) where they were created to your default (or other) template (.wpt), see below.
    How to create a "QuickStyle"

    QuickStyles are styles created based on the formatting in effect at the current cursor location.

    [This is a similar feature to Format, QuickFormat, which lets you copy the format of text and apply it elsewhere in the document; however, creating a QuickStyle allows you to save it as a new custom style.]

    Note that in recent versions of WordPerfect you cannot create a QuickStyle while inside a header, footer, footnote, endnote, text box, or other "substructure".

    Step 1. Click in or select the text that is in the format you want.

    Step 2. Click Format, Styles.

    Step 3. Click the QuickStyle button.

    Step 4. Type a name for the style in the Style Name box.

    Step 5. Type a description for the style in the Description box.

    Step 6. Enable one of the following buttons:

    •  Paragraph With Automatic Update — applies the style to the paragraph in which the cursor is positioned

    •  Character With Automatic Update — applies the style to selected text or to text you are about to type

    Step 7. Click OK, then Close.

    Step 8. Apply the style: You can apply the style to selected text by choosing it from the "Select Style" drop list on the text property bar, or by clicking Format, Styles, <style name>, Insert.

    Optional: You can save the QuickStyle as a new custom style. See below.

    Page Top

    How to use "QuickFormat"

    QuickFormat lets you copy the format at the cursor location — i.e., the format of text characters, a paragraph heading, or a table cell — and apply it elsewhere in the document.

    Though similar to a QuickStyle, it is generally used to quickly modify just the current document's text. Therefore, if you think you might need to save the formatting as a style for future documents, consider creating a QuickStyle above instead.

    [The following procedure is from WordPerfect X5's Help <F1> key; however, the procedure should be similar in other versions).]

    "You can copy the format of text and apply it to other text in a document. If you want to copy selected text, then formatting attributes, such as font, font size, and font style, are all copied. If you want to copy the heading in a paragraph, the paragraph style as well as the font and its attributes are copied.

    When you copy the format of text, you automatically create a text style. Changing text that has been formatted using a text style also changes other text in the document that uses that style.

    Step 1. Click in the text whose format you want to copy.

    Step 2. Click Format, QuickFormat.

    Step 3. Enable one of the following options:

    •  Selected characters — copies the format of the font and its attributes

    •  Headings — copies the format of the paragraph and its styles, and the font and its attributes

    •  Table cells — copies cell attributes, text colors, fonts, fills, and lines

    •  Table structure — copies table borders, fills, default line, and table style

    Step 4. Click OK.

    Step 5. Drag the QuickFormat paintbrush pointer [which looks like a paint roller] over the text to which you want to copy the format.

    Step 6. Click Format, QuickFormat."

    Tips

    ☼  You can also enable or disable QuickFormat by clicking the QuickFormat button (which looks like a paint roller).
     

    ☼  QuickFormat is disabled when no check mark displays beside the QuickFormat menu command.

    ☼  If you might need to save the style for future documents, consider creating a QuickStyle above instead.

    Page Top

    Editing, modifying, and copying existing styles

    Here's how to edit an existing style or create a modified version of an existing style.

    Note that it is a good idea to first make a copy of an existing style (or anything else you want to modify), saving it with a different name, then modify the copy (not the original). [See also "Retrieving custom (user) styles from another document or template" below.]

    Advantage: Renaming new custom styles that are based on existing styles is especially useful in an organization where many users might share documents, compared to a solo practice where modifying the original item without renaming it isn't usually a problem later on.

    Tip: You can also copy system styles such as the factory-shipped Heading styles. This lets you modify them and/or rename them to something more useful to you.

    •  To make a copy before you begin making modifications, use the Options button on the Format, Styles dialog. You can make a copy just to the current document, then if all goes well, you can save the copy to the default template (next section).

    •  To modify the copy: The easiest way is to apply the style in a document, then simply double-click the [Style] code for that style in Reveal Codes. This brings up the Styles Editor, where you can use its menu to Insert a Tab, or use its Format, Paragraph menu to add an Indent, and so forth. You can also insert format codes such as [Bold] or [Large] from either the Styles Editor's menu or its property bar.

    •  Note that if the style has not yet been applied in the document, but exists in the template that spawned that document, you can edit the style from the main WordPerfect menu with Format, Styles in much the same way you can create a style from scratch as explained above. Again, it is wise to make a copy of it first.

    •  Resetting the modified style: If you modified a standard, system (i.e., built-in) WordPerfect style, such as a Heading style, instead of making a copy of it to modify, you can always reset the system style to the factory default state: see below.

    [Although not a common procedure, you can also hide the standard system styles from view by editing the template (so that it applies to new documents) and using the Options button to choose Settings; then disable (un-tick) the "WordPerfect system styles" option; then save the template. This does not remove the system styles from the program itself, it just hides them from view. To restore them to view, just edit the template and reverse the process.]

    Saving custom styles to your default (or other) template


    If you intend to use a newly created custom style or a modified style in new, blank documents, you will need to copy it to your default (or other) template, as explained in this section.

    You can also copy custom styles from another document or template to a disk file, then import (retrieve) them into the default or custom template. See the next section, under "Traditional methods".

    Methods

    When you create a style (or edit an existing style) it is automatically saved in the current document. If you want it available in future documents, you need to save the custom style to the default template or a custom template.

    Saving styles to the default template:

    Step 1. Open the document that contains the custom style. Click Format, Styles to bring up the Styles editor.

    Step 2. Select (i.e., click on) the custom style in the "Available styles" list, then click the Options button, then Copy.

    Step 3. In the pop-up "Styles Copy" dialog that appears, choose "Default template," then click OK. The style will now be available in all new documents based on the default template from that point forward.

    Saving styles to a custom template:

    If you want to copy the style to a existing template other than the default template so that the style is available in new documents based on that specific template:

    Step 1. Copy the style to the default template as described above. Then click File, New from Project (or File, New in WP8) and select the template to which you want to add the new style. Basically you want to open this "target" template and copy the styles into it from the "source" template (the default WP template).

    Step 2. Click the Options button, then "Edit WP Template." When the template appears, use the Copy/Remove Object button on the Template property bar to bring up the dialog that lets you select the Template to copy from (e.g., WP12US.WPT for WP12's default US template), the Object type ("Styles"), and the custom styles to copy (in the left-hand field). Click Copy>> to add the style(s) to the currently edited template.

    Step 3. Click Close twice, then "Yes" to save changes, to return to the main editing screen.

    Alternative: 

    An alternative to this method is to copy custom styles to a disk file, then import (retrieve) them into the template. See the next section, under "Traditional methods".)

    Note

    Displaying styles in the Format, Styles dialog and in the Select Style drop list on the Text property bar:

    By default these are set to automatically display so that you can select or edit a style. The settings to display or not display certain styles are found on the Style Settings dialog, which can be accessed via Format, Styles, Options button, Settings, and as further explained here.

    Page Top

    Retrieving custom ("user") styles from another document or template

    Need one or more user-created styles (a.k.a "custom" styles) from an earlier version of WordPerfect?

    Want to use a custom style from an existing document — even if you didn't create it?

    There are several traditional and non-traditional ways to obtain custom styles (including outline styles and graphics styles) without having to recreate them from scratch. These are described in the sections below.

    Tips

    ☼  After retrieving custom styles into a document with one of the methods below, you can replace existing styles in that document with the new styles using a macro such as ReplSty (they must be named differently when using this macro).

    ☼  You can remove unused styles by name from a document or template. See below.

    ☼  Caution:

    If you load (open) a document created on another computer that contains a custom or customized style (including Outlines, which are also styles) and that has the same name as an existing system style on your computer, the system version (a.k.a. "standard" or "factory shipped" version) of the custom(-ized) style on your computer will become the "active" version in that document. Essentially, it replaces the incoming (i.e., imported) same-named styles in the document.

    Solution: Have the sender use style names that differ from standard, shipping names when they create or modify a style for distribution.

    Reference: See this thread on WordPerfect Universe for how this affected users in a law firm with a customized, standard outline style created by an attorney who propagated it to his staff though various documents he created. In each case, since the propagated (customized) version of the outline style had the same name as his staff's existing system style, it was superseded by the staff's existing system version when they loaded the documents!

    Operation: This seems to be similar to the operation of the Updater.wcm macro, which updates (resets) any on-screen (or on-disk) document with the current system's default styles, etc. 

    TRADITIONAL methods
    METHOD 1. Saving and retrieving a custom style in the Styles dialog

    The traditional approach is to first save the custom (user) styles to a special file on disk, then retrieve it later.

    This method is useful if you don't have the original document file or WordPerfect template available later to make a copy of the user-created custom styles.

    Step 1. Save the custom styles to disk.

    Step 1A. To save the user styles, open the document (or template) that contains the desired styles. Click on Format, Styles, Options button, Save As. Click on the "User styles" radio button (this saves all user-created styles) and type in a filename. It's probably a good idea to give the filename a recognizable extension such as ".STY". The style file is saved to the default template folder as shown in Tools, Settings, Files, Template.

    Step 1B. Similarly, save any custom graphics styles with Format, Graphic Styles, Options, Save As, and any custom outline styles with Insert, Outlines/Bullets & Numbering, Options, Save As, User Styles.

    Step 2. Retrieve the custom files from the disk.

    To retrieve these custom user styles, open the "target" document or template for editing and click on Format, Styles, Options button, Retrieve, and specify the name of the saved style file. Click on the "User styles" radio button.

    Note: In the Style type area, the options are:

    "Both" - this retrieves both the styles you have created and the preset styles provided with WordPerfect;

    "User styles" (this is the one you want here) - retrieves only the styles you or other persons have created;

    "System styles" - retrieves only the preset styles provided with WordPerfect.

    Also, when you retrieve a file the styles in that file are saved with the active (current) document. To save them in the default template, see Step 3.

    Click OK. The custom styles in the original source document should show up in the Styles dialog "Available styles" list.

    Remember to retrieve any custom graphic or outline styles you exported in Step 1. For graphic styles: Format, Graphic Styles, Options, Retrieve. For outlines: Insert, Outlines/Bullets & Numbering, Options, Retrieve.

    Step 3. [Optional]

    While still in the new document, you can copy any new user style to your default template with Format, Styles, <choose the new style from the "Available styles" list>. Click the Options button, then click Copy, Default template, OK, Close. Repeat for other custom styles you want to add to the template.

    You can slso copy any custom graphic or outline styles to the default template. For graphic styles: Format, Graphic Styles, Options, Copy, etc. For outlines: Insert, Outlines/Bullets & Numbering, Options, Copy, etc..

    Tips

    ☼  As an alternative to Step 3, you can retrieve the styles directly into the default template by first clicking Format, Styles, Options, Settings; click the option to save to the default template; then do Step 2 to retrieve the style file. However, the above three steps may be less problematic and have the advantage of letting you select the particular styles to copy to the default template.

    ☼  For more on preserving customizations when upgrading or reinstalling, see this thread on WordPerfect universe.
    METHOD 2. Import custom styles from one template into another template

    This method requires you to edit a custom template to retrieve styles from the original template.

    How to do it

    You can import other "objects" -- customized keyboards, toolbars, menus, styles, etc. — from another template (if they are not already present in the new template) with the Copy/Remove Object button on the template property bar.

    Simply click the Copy/Remove button, choose the Template to copy from, choose the Object type (i.e., Styles), select one or more styles, and click Copy to import them. Click Close when finished, then Save the template.

    Notes

    ¤  Save and back up the new custom template before importing other objects.
    This is especially important if you have spent a lot of time customizing the new template before importing other objects into it.

    ¤  The template to be copied from must be in the same folder on your system where the custom template is located.

    ¤  Some Styles available in the old template can be either normal format styles or outline styles. WordPerfect doesn't tell you which type of style they are in the Copy/Remove Template Objects dialog's Styles list, but when you copy them to the new template they will show up in the new template in the appropriate place (either the Format, Styles menu, or the Insert, Outline... menu, respectively).


    NON-TRADITIONAL methods
    METHOD 1. Using a small macro to retrieve user (i.e., custom) styles
    Method 1a: Retrieve (and insert) several custom (user) styles with a macro

    Unlike the traditional method above, this method is useful if you have the original document file or WordPerfect template available that contains the custom styles you need.

    Create a macro (see Footnote 1); be sure to change the drive-path-filename in the macro command below to the "target" template/document that contains the user styles you want to import into the current document or template.

    Also: Be sure to retain the double quote marks surrounding the drive-path-filename, and note that the macro command should be all on one line:

    StyleRetrieve("drive-path-filename"; UserStyles!; CurrentDoc!)

    Note: For outline styles, use:

    OutlineStyleRetrieve("drive-path-filename"; UserStyles!; CurrentDoc!)

    Play the macro in the current document. It should retrieve all custom styles (or Outline styles) into the current document.

    Note that this will overwrite current custom styles in that document that have the same name. (For customized standard styles, see the note of caution above.)

    You can edit a template file (.wpt) and play the macro so that the new styles will be present in any newly created document that is based on that (revised) template. Needless to say, always make a backup of a template before modifying it.

    If you need to use the macro frequently, you can assign it to a menu, toolbar button, or keystroke combination. See here.

    Method 1b: Retrieve (and insert) several custom (user) styles from inside a macro

    [For advanced users]

    You can create a macro as a "container" and insert several styles from it into any open document or template. (The method can retrieve outlines, too; see Notes below.)

    This might be useful for distributing custom styles to many users in an organization, or to update an existing (and currently open) document or template on your own system.

    Just open the document or template and play the macro to import the styles. [Thanks to Noal Mellott for this tip and technique, posted on WordPerfect Universe, 8-23-06.]

    Method and operation

    While similar to Example #1 above, there is a significant difference: The custom styles are stored inside the macro itself.

    As with any WordPerfect file, you can create and save one or more custom styles — i.e., a personal or company "style library" — inside a macro file (.WCM). The macro then acts like a briefcase to transport these styles. The macro can be used to insert (or replace) styles into any open document or template simply by playing the macro while in that document or template.

    In operation, the macro uses a single StyleRetrieve() command to insert the custom style library stored in the macro itself into the current document (.WPD), or into a template (.WPT) that is open for editing. The one-line command might look something like this:

    StyleRetrieve("C:\Documents and Settings\Administrator\My Documents\WordPerfect\My WPX3 Macros\MyStyleLibraryMacro.wcm"; UserStyles!; CurrentDoc!)

    Notice that this macro points specifically to the macro filename on disk ("MyStyleLibraryMacro.wcm"). That is, it points to itself, not just to the folder which contains the macro.

    You can create the styles to put in the new macro file, or use one of the methods in the next section below (e.g., Method 2) to insert one or more existing styles into the macro file.

    For an example of this, see Noal Mellott's StyleLibraryPrimary macro at WordPerfect Universe. You can edit it to remove the styles you don't want, and/or edit it to include your own custom styles. NOTE: Be sure to edit and recompile it (with Save & Compile) at least once or it might not work.

    Notes and tips

    ¤  The StyleLibraryPrimary macro's StyleRetreive command uses the standard path and filename code (Insert > Other > Path and Filename) as the command's first parameter, instead of the usual text string or label. This technique allows the macro to be placed anywhere on the system and still function properly, since the code always points to the current location of the macro.

    ¤  Note also that the StyleRetrieve command has a parameter to let you retrieve user styles, system styles, or all styles. You most likely would retrieve just your custom user styles.

    ¤  You can modify the macro to insert custom Outlines, too. Outlines are just another form of WP style, linked to one or more "level" styles that each apply specific formatting.

    •  To do this, either create the custom outlines in the macro file itself (Insert, Outline/Bullets&Numbering, Create [or use Copy, then Edit]) -or- retrieve them into the macro file with Insert, Outline/Bullets..., Options, Retrieve. Once the custom outlines are embedded in the macro file, edit the macro's code to include a OutlineStyleRetrieve() command. [You can copy the macro's existing StyleRetrieve() command -- with all its parameters -- and simply add the word Outline to the beginning of the command line (with no spaces, as above).]

    •  More on custom outline headings: As an example, to create automatically numbered Legal-, Standard-, and Roman-style headings, see "Legal-style Headings: How to combine Outline numbering with a default or custom Heading style formatting to create automatically numbered Legal Headings," here.

    ¤  In a later WordPerfect Universe post Noal showed a code snippet that you can add to the top of his macro (or use in any macro) that can rename existing styles. The code was basically the following (where <Original> and <New> represent the original style and new style name, respectively):

    Error(Off!)
    StyleEditBegin("<Original>"; CurrentDoc!)
    StyleCodes (WithoutOffCodes!; CurrentDoc!)
    StyleRename("<New>")
    SubstructureExit()
    StyleEditEnd(Save!)
    Wait(3)
    Error(On!)

    ¤  If you need to use the macro frequently, you can assign it to a menu, toolbar button, or keystroke combination. See here.

    METHOD 2. "Clipping" custom styles from other documents

    Here are several methods you can use to copy a style that was either created by someone else or created in an earlier version of WordPerfect on your own system.

    The methods copy the styles from an existing document to either your current document or your default (or other) template. (Copying to a template makes it available for future use.)

    Method 2a: "Block retrieve" styles

    This is slightly different from the traditional method given above. Here, you don't need to first save the style to a disk file, if the document containing the style is still available on your system. It is similar to the traditional method in that it copies all user-created styles from the source document. You can then choose which ones to add to your default template.

    Step 1. Make sure the source document that contains the custom style is available on your system (it doesn't have to be open).

    Step 2. Open the target document or a blank document. Click on Format, Styles, Options button, Retrieve. In the "Retrieve files from..." dialog that pops up, browse to the filename of the document that contains the desired style and choose it. Click on the "User styles" radio button.

    Note: In the Style type area, the options are:

    "Both" - this retrieves both the styles you have created and the preset styles provided with WordPerfect;

    "User styles" (this is the one you want here) - retrieves only the styles you or other persons have created;

    "System styles" - retrieves only the preset styles provided with WordPerfect.

    Also, when you retrieve a file the styles in that file are saved with the active (current) document. To save them in the default template, see step 3.

    Click OK. The custom styles in the original source document should show up in the Styles dialog "Available styles" list of the current (target) document.

    Step 3. While still in the new document, you can copy any new style to your default template with Format, Styles, <choose the new style from the "Available styles" list>. Click the Options button, then click Copy, Default template, OK, Close. Repeat for other custom styles you want to add to the template.

    Method 2b: Retrieve a single style

    This approach lets you "grab" a single style from a source document containing the style -- perhaps a document originally created by someone else on another system.

    Step 1. Open the document that contains the desired custom style. Use your mouse or keyboard to select a single word and apply the style to the word. The word should be on its own line with no other codes or text.

    Step 2. Open Reveal Codes. Put the cursor in front of (i.e., to the left of) the style code, and look at the information on the style code itself.

    Note that there are three basic types of styles: Character, Paragraph, and Document (or Open). The type should be visible on the code itself in Reveal Codes.

    The first two style types (Character and Paragraph) are paired-code styles; the latter (Document) is produced by a single code that remains in effect until replaced by another Document style.

    Step 3. Select the style code and the word. If the style is a Character or Paragraph style, be sure to select both the beginning code and the ending code as well as the word to eliminate spurious formatting. If it's an Open code, just select the code and the word.

    Step 4. Copy the code(s) and word to the clipboard with <Ctrl+C>.

    Step 5. Open a new, empty document (or other document) and paste the clipboard contents into it with <Ctrl+V>. Look in the "Select style" drop list on the Text property bar; you should see the new style appear in the list along with any other styles stored in your default template.

    Step 6. While still in the new document, you can copy the new style to your default template with Format, Styles, <choose the new style from the "Available styles" list>. Click the Options button, then click Copy, Default template, OK, Close.

    METHOD 3. [For intermediate/advanced users:] You can write a macro to create and insert a style into any document or template.

    Tip: Using a macro to insert a style might also be useful in distributing the style to many users in an organization.

    Here are some examples using this technique that work in WordPerfect 8 and later versions.

    The first example macro creates a bold, underlined red character style in the current document (only). If text was selected first, it will apply the style to the selected text; otherwise, it will apply the style, and you should then immediately type the text between the paired style codes (press Enter to move past them).

    The second example macro does something similar -- it creates a red character style in the current document -- but with a slightly different technique.

    Example 1. Here's how to create one using Arial Black, 10-point font. (Obviously, edit the code to use your preferred font, font size, color, etc.)

    To copy the code into WordPerfect, see Footnote 1.

    // Macro begins here:

    // If text was selected, mark it:
    If(?BlockActive)
      BookmarkCreate("Temp_mark")
    Endif

    // If the named style already exists, skip creation:
    OnError(SkipApplyStyle@)

    StyleCreate (Name: "SampleStyle"; Type: AutoCharacterStyle!; Library: CurrentDoc!)

    StyleEditBegin (Style: "SampleStyle"; Library: CurrentDoc!)

    StyleDescription (Description: "Sample character style")

    StyleEnterKeySetting (Action: StyleOff!)

    StyleCodes (State: WithOffCodes!; Library: CurrentDoc!)

    Font ("Arial Black Regular")
    FontSize (10p)
    AttributeAppearanceToggle (Attrib: Underline!)
    TextColor (Red: 255; Green: 0; Blue: 0)
    SubstructureExit ()
    StyleEditEnd (State: Save!)
    Label(SkipApplyStyle@)

    // Reselect the text if it was originally selected:
    OnError(SkipFindBookmark@)
    BookmarkFind("Temp_mark")
    BookmarkBlock("Temp_mark")
    Label(SkipFindBookmark@)

    // Apply the style:
    StyleOn ("SampleStyle")

    // If text was selected, move the cursor before exiting:
    If(?BlockActive)
      PosBlockBottom
      SelectOff
    Endif

    // Remove the temporary bookmark:
    BookmarkDelete("Temp_mark")

    // Macro ends:
    Return

    [Note: Since WordPerfect 9, you cannot record a style, you have to code it manually. (I cheated: I used WP8 to record things and then edited the results.)]

    Example 2. Here's a macro posted by Kenneth Hobson on WordPerfect Universe (here) that (1) stores all styles in the document (default and custom) in a variable array; then (2) checks to see if the to-be-created style exists in the array (if not, it creates it); then (3) it inserts the style at the cursor location.

    To copy the code into WordPerfect see Footnote 1.

    For a more advanced version that also applies the style in the document, see Footnote 3.

    [Note: In some earlier versions of WordPerfect, the first time you play the macro you might see a harmless error message about the obsolete (but still functioning) GetData command. Ignore it and Continue compiling the macro.]

    // StyleColorRed.wcm by Kenneth Hobson.
    // Get style names in current document:
    GetData(x;Styles!;Count!;CurrentDoc!)
    Declare aStyles[x]
    ForNext(i;1;aStyles[0])
        GetData(y;Styles!;Name!;CurrentDoc!;i)
        aStyles[i]=y
    EndFor

    // Check for the existence of a particular
    // style name in the current document:
    loc="ColorRed" IN aStyles[]
    If (loc=0) // if it doesn't exist, create it:
        StyleCreate("ColorRed";CharacterStyle!)
        StyleEditBegin("ColorRed";CurrentDoc!)
        StyleCodes(WithOffCodes!;CurrentDoc!)
        TextColor("Red")   // or use TextColor(;255;0;0)
        SubstructureExit()
        StyleEditEnd(Save!)
    EndIf

    // Insert the style at the cursor location:
    StyleOn("ColorRed")

    // Macro ends:
    Return

    Page Top

    How to reset a modified standard style to its WordPerfect default state

    Note

    This section applies to standard, "factory shipped" WordPerfect styles.

    For user-created styles, you can edit them with Format, Styles to change them, or you can simply delete them with
    Format, Styles, Options and re-create them.
    For the current document, simply click on Format, Styles, <style name>, Options button, Reset.

    For the template (default or custom), edit the template with File, New from Project (or just File, New in older versions), choose the category from the Create New drop list, then click on the name of the template to reset. Then:

    •  Click the Options button, then click Edit WP Template.

    •  When the template opens (it should have a filename at the top of the WordPerfect window that has a .WPT extension), click Format, Styles, <style name>, Options button, Reset. Answer Yes to "Reset style to default state?," then click Close to retutn to the template.

    •  Save the template: click the Close button on the template property bar and answer Yes to the message about saving.

    If the Reset button is grayed (greyed) out, this usually means that the style is a user-created custom style and not a standard WordPerfect style that was modified. You can edit the user-created style (with Format, Styles) to change it, or simply delete it with Format, Styles, Options, Delete.

    Page Top

    How to remove styles from a document, a custom template, or from the default template

    Removing individual custom styles from a document or template

    You can delete a text style that you have created -- but you cannot delete any of the preset factory shipped styles (even modified ones) provided with WordPerfect. [However, you can reset factory styles to their default state (see above).]

    When you delete a user-created custom style, you can delete just the style itself (leaving its format codes behind) -or- you can delete both the style and the formatting codes, as described in Method 1.

    Method 1 (manual removal)

    [Back up the file first.]

    1. Open the document or custom template for editing. (For help editing the default template see below.)
    2. Click Format, Styles.
    3. Choose the style from the Available Styles list box.
    4. Click Options, Delete.
    5. Choose the style you want to delete from the Select Styles To Delete list box.
    6. Enable one of the following buttons:

    • Including Formatting Codes -- deletes the [Style] codes and any formatting codes inside the style
    Leave Formatting Codes In Document -- deletes only the [Style] codes, leaving any formatting codes alone that are inside the style

    Neither option deletes any text or graphics that might be inside the [Style] code

    Method 2 (macro removal)

    Create a small one-line macro to delete the specific style when you play it. If the style is in the currently open (for editing) document or template, the following deletes it (leaving the format codes behind) while keeping the text to which the style was applied. (To copy it into your program see Footnote 1.)

    StyleDelete (Style: "MyStyle"; Codes: LeavingCodes!; Library: CurrentDoc!)

    Be sure to change "MyStyle" to your custom style's name (but retain the quote marks).

    Method 3 (macro removal)

    Another alternative is to use a macro that removes all styles in the document except for system and custom styles saved in the document's template, deleting just the style and leaving its format codes and text behind. See for example, the one by Roy Lewis posed on WordPerfect Universe here.

    Removing all unused custom styles from a particular document or a custom template

    Use Corel's WPLOOK

    The easiest way to remove all unused styles at once from a particular document (closed, on disk) is to use the free, standalone Corel file repair utility, WPLOOK.EXE.

    To get and use WPLOOK.EXE, see here.

    Removing all unused styles is handy if -

    (1) you hate scrolling through dozens of unused styles in the Styles list, or

    (2) you want to reduce the size of the document (even if only slightly), or

    (3) you do not want to share any custom styles (except those that are needed to format the document) with a recipient of the document. The latter is often done with macros, too, which are just a type of WordPerfect document.

    If enabled with a checkbox on its menu, WPLOOK removes just those styles that are not in use in the document. (Think of that option as a "clean up" routine. However, WPLOOK's main function is to repair damaged files, as discussed here.)

    Notes

    ¤  While WPLOOK can remove all unused custom styles present in the current document, it does not remove styles that are part of (saved in) the template on which that document was based. (You can edit the template and use either of the methods above, or the method below, to remove those styles.)

    ¤  WPLOOK does not remove unwanted styles used somewhere in the document text: it removes all unused styles stored inside the document. You can use the methods above to remove unwanted individual styles in the document's text.

    ¤  As noted above, you cannot remove factory shipped ("system") styles (e.g., Heading 1 .. Heading 5). However, you can reset factory styles to their default state (see above).
    Removing a custom style from the default template

    Caution: If you edit the default template, or any template for that matter, it is always a good idea to make a backup of it first.

    1. Click on File, New From Project (or just File, New in WP8).

    2. In the drop-down list under the "Create New" tab, select (i.e., click on) the category, "Custom WP Templates."

    3. Select "Create a blank document." This is the (oddly named) default template on which all new (blank) documents are based.

    [Note: If you have installed more than one version of WordPerfect you will see additional "Create a blank document" templates listed. Just right-click on each one and examine its Project Properties; this will tell you the Project filename of the template the item is based on. You can then rename the item in the Project list via the Display Name field. See here for a detailed explanation.]

    4. Click the Options button, then select "Edit WP Template." The default template should load on screen. (It will have a .WPT filename extension at the top of the window.)

    5. [As in Method 1 above:] Click Format, Styles, and choose the style to delete. Click Options, Delete to bring up a dialog where you can delete the style.

    6. Click File, Save and close the template.

    Page Top


    Footnotes section

    Footnote 1

    To copy a macro from a newsgroup message, web page, e-mail, or other Internet source -

    Select all text from beginning to end, and copy it to the Windows clipboard with <Ctrl+C> or Edit, Copy;

    Open a new (blank) document in WordPerfect and click on Tools, Macro, Macro Toolbar to display the Macro Toolbar;

    Position your cursor after any codes in Reveal Codes, and click on Edit, Paste Special, Unformatted Text to paste the macro code into the WP document without any extraneous formatting or other unwanted codes. [Generally, you will want to copy the original code as plain text. Later, you can highlight it or use redline, color, bold, etc.];

    Check the pasted text for long lines that may have wrapped into two or more lines with a hard return [HRt] or line break [Ln Brk] between them; in Reveal Codes, delete the hard return(s) or line break(s) to "glue" the lines back together;

    Save the pasted material with the Save & Compile button on the Macro Toolbar. This will save the macro to your default macros folder as shown in Tools, Settings, Files, Merge/Macro.

    Page Top


    Footnote 2  [Advanced users]

    To apply a style to several words or phrases wherever they appear in the body of the document:

    Step 1. Create the style in the document or the template that spawned it. (You can also do this with a macro, such as the one that follows below.)

    Step 2. Copy this macro into your WordPerfect (see Footnote 1 above). Be sure to (1) use your own words/phrases in the Array[] command; and (2) use the correct name of your style in the StyleOn() command below (the example uses "BoldRed").

    // Macro begins here

    // Here, store your words/phrases in an Array[] variable;
    // replace these six examples with your own items
    // (keep each of them under 79 characters, including spaces):

    Array[]={
    "Shakespeare";
    "London";
    "Leased Premises";
    "Master Lease";
    "improvements";
    "Transferee" // <- Note: last item does not end in a semicolon
    }
    pResetFindReplace ()
    OnError(Msg@)
    ForEach(vVar;Array[])
    PosDocVeryTop()
    // SearchFindWholeWordsOnly(Yes!) // <- OPTIONAL
    // SearchCaseSensitive (State: Yes!) // <- OPTIONAL
    SearchString (StrgToLookFor: vVar)
    OnNotFound(NextOne@)
    While(true)
    SearchNext(Regular!)

    // Note: use your own style's name here in place of
    // "BoldRed" (but retain the quote marks):

    StyleOn("BoldRed")
    Endwhile
    Label(NextOne@)
    Endfor

    Label(End@)
    pResetFindReplace ()
    Return

    Label(Msg@)
    Messagebox(;;"Style not found!")
    Go(End@)

    Procedure pResetFindReplace ()
    SearchString("") ReplaceString("")
    // Only one Match* command can be active at any one time:
    // MatchPositionAfter()
    // MatchExtendSelection()
    // MatchPositionBefore()
    MatchSelection()
    SearchFindWholeWordsOnly(No!) MatchWithAttributes(No!)
    ReplaceWithAttributes(No!) SearchCaseSensitive(No!)
    ReplaceWithCase(No!) MatchWithFont(No!)
    ReplaceWithFont(No!) MatchWithFontSize(No!)
    ReplaceWithFontSize(No!) SearchInSelection(No!)
    SearchWordForms(No!) SearchWrap(No!) MatchLimit(No!)
    EndProcedure

    // End of macro

    Page Top


    Footnote 3

    To create a custom Character style with a macro:

    Here's an example macro that can create a Character style when it is played in the current document (or in a template, if it is played in the open template), and store it in the Styles list. (See also the alternative macro below.)

    There is no harm in playing it multiple times in the same document: It will only store the style once.

    It uses a Character style named "BoldRed" whose purpose is to apply a bold font attribute plus a red text color.

    Options and tips:

    •  It can also include a different font: See the Font and FontSize commands in the macro, which here are disabled. Note that you could as easily use the Redline! attribute instead of a red text color, and/or use Underline! or other attributes.

    •  There are 3 optional lines (currently disabled) to create square brackets around the text to which the style is applied. This might be useful to create bracketed draft text that can be easily reformatted by editing the [Style] code later (e.g., to remove the brackets).

    •  Note also that the macro does its work without notification to the user. Just check the Styles list (on the Text property bar or in the Format, Styles dialog) after you play it to verify its presence in that document.

    To copy this macro into your WordPerfect see Footnote 1 above.

    // Macro begins here

    // PURPOSE: Create a BoldRed Character style.

    // COMMENTS and commands here:

    // If the named style already exists, OnError skips this segment:
    OnError(SkipCreateStyle@)

    // Next, open the Styles Editor and create the basic style
    // (all Style commands should be on separate lines):

    StyleCreate (Name:"BoldRed"; Type:AutoCharacterStyle!; Library:CurrentDoc!)
    StyleEditBegin (Style: "BoldRed"; Library: CurrentDoc!)
    StyleDescription (Description: "Bold+Red character style")
    StyleEnterKeySetting (Action: StyleOff!)
    StyleCodes (State: WithOffCodes!; Library: CurrentDoc!)

    // Insert custom formatting in the Styles Editor:

    //Font ("Arial Black Regular") // <- Optional
    //FontSize (10p) // <- Optional
    AttributeAppearanceToggle (Attrib: Bold!)
    TextColor (Red: 255; Green: 0; Blue: 0)
    //Type("[")
    // <- Optional
    //PosDocBottom // <- Optional
    //Type("]") // <- Optional

    // Exit from the Styles Editor:

    SubstructureExit ()
    StyleEditEnd (State: Save!)

    // Exit macro here:
    Label(SkipCreateStyle@)
    Return

    // Macro code ends here

    Alternative:

    Here is a slightly more advanced version (originally posted on WordPerfect Universe here)
    that -

    (1) creates a bold, italicized, redlined, bracketed custom style in the document if it does not already exist, and

    (2) applies it to previously selected text (or if nothing was selected, inserts it into the current cursor location ready for text to be typed into the style).

    It might be used to convert existing text (or insert newly typed text) as specially marked text [like this] into the document. Later, you can simply edit any instance of the [Style] code to change the attributes/brackets, or simply remove them in the Styles Editor to revert the text back to its original format. All instances of the style in the current document will change accordingly.

    [However, if you manually change the style's formatting in the macro code below, this will not change anything in the document where the style as already been applied since the macro will see that the style name already exists. You will need to either delete the existing style in the document's Format> Styles dialog to allow using the new formatting when you play the revised macro, or give the revised style a different name.]

    Note that you can give the style your own name in the first command (i.e., vStyleName:="").

    You can also revise the style's formatting in the blue area of the If/Endif segment.

    To copy this macro into your WordPerfect see Footnote 1 above. [In some earlier versions of WordPerfect, the first time you play the macro you might see a harmless error message about the obsolete (but still functioning) GetData command. Ignore it and Continue compiling the macro.]


    // Macro begins here

    // Set the preferred style name here:
    vStyleName:="BoldRedBrackets"

    // COMMENTS and commands here:

    // Set a flag if something was previously selected, then
    // turn select mode off:
    vFlag:=0  If(?BlockActive)  vFlag:=1  SelectOff  Endif

    // Get style names in current document:
    GetData(x;Styles!;Count!;CurrentDoc!)
    Declare aStyles[x]
    ForNext(i;1;aStyles[0])
        GetData(y;Styles!;Name!;CurrentDoc!;i)
        aStyles[i]=y
    EndFor

    // Check for existence of the style in the current document:
    vLoc=vStyleName IN aStyles[]

    // if it doesn't exist, create it:
    If (vLoc=0)
        StyleCreate (Name:vStyleName; Type:AutoCharacterStyle!; Library:CurrentDoc!)
        StyleEditBegin (Style: vStyleName; Library: CurrentDoc!)
        StyleDescription (Description: "My custom character style")
        StyleEnterKeySetting (Action: StyleOff!)
        StyleCodes (State: WithOffCodes!; Library: CurrentDoc!)
        // Add desired formatting in the Styles Editor:
        // Font ("Arial Narrow") // <- Optional
        // FontSize (10p) // <- Optional
        AttributeAppearanceToggle (Attrib: Bold!)
        AttributeAppearanceToggle (Attrib: Italics!)
        AttributeAppearanceToggle (Attrib: Redline!)
        // Or -- use a text color:
        // TextColor (Red: 255; Green: 0; Blue: 0)
        Type("[")
        PosDocBottom  // (go to bottom of Contents pane)
        Type("]")
        // Close and exit the Styles Editor:
        SubstructureExit ()
        StyleEditEnd (State: Save!)
    Endif

    If(vFlag=1)
        ReselectLastBlock
        vFlag:=0
    Endif

    // Apply the style in the document:
    If(?BlockActive)
        StyleOn(vStyleName)
        PosSelectBottom
        SelectOff
    Else
        StyleOn(vStyleName)
    Endif

    // Exit from the macro
    Return

    // Macro code ends here

    Page Top