| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Sep 1, 2017|
Main tips page | Browse tips
Page Numbering in WordPerfect
Page Numbering in WordPerfect: The Basics, by Jan Berinstein at WordPerfect Universe.
to clear page numbering in a document to resolve page numbering issues
-- a Corel support article explaining the use of Find & Replace to
delete existing page numbering codes. It explains there are 7 candidates beginning with "Pg Num" -- plus 2 Delay codes that might also enable
page numbering by virtue of having page numbering codes inside them.
Tip: These codes (and many others) can also be quickly deleted throughout the document using the DelCodes.wcm macro here.
Important: Delay codes are designed to hold specific formatting inside them until needed on specific pages. Hence they might contain page numbering codes (e.g., even WordPerfect often inserts them when it needs them). So rather than automatically delete them like you might do with other page numbering codes (enumerated in the Corel article above) with Find & Replace or with a macro like DelCodes.wcm, existing [Delay] codes are best examined first by manually opening them to edit them. (See the Delay codes page on this site.) If you find page numbering codes inside them, these codes can be deleted, leaving alone any other format codes you (or the program) might want to keep. (See Footnote 1.)
Forcing a page number
(from WPX7's Help <F1>:) "By forcing a page number, you can
insert a new page or make sure that a certain page in a document always
has an odd or even page number. ... (1) Click on the page where you
want to force a page number. (2) Click Format, Page, Force Page. (3)
Enable [the appropriate option]."
Getting the true (physical) page count: Some page numbering schemes change page numbers midway in the document (e.g., Roman numerals for various "front matter" followed by page number "1" at the beginning of the main document [see next section below]), so the total pages that can be displayed via a page number [code] might not reflect the actual number of printable pages in the document. You can get this count with File, Properties, Word Count (tab), "Pages". (Macro equivalent: Footnote 2).
Some related tips
Headers and/or footers are often used to contain page numbering -- especially custom page numbering formats or locations; see (e.g.) "Page X of Y" numbering inside a header or footer as well as the several links below.
Page identification: Alternating even/odd page numbering using headers or footers; using a third header or footer.
Page numbering in (some) books - using headers or footers to create a page number at the bottom of the first page of a chapter or section with remaining page numbers at the top of subsequent pages.
Page numbering using both Roman and Arabic numerals - How to use Roman numeral page numbers for initial material ("front matter") or elsewhere in a document, and Arabic numbers for the rest of the document.
Using two footers simultaneously (one for page number, the other for separator line and filename, etc.) so that items do not overlap.
Page numbering outside the page margins - simulating page numbering outside the document's normal top and bottom page margins
Consecutively numbered labels, tickets, cards, sheets, etc.
How to create "Continued on Page x" footers where "x" is the number of the following page.
Mixing landscape and portrait pages - how to maintain headers, footers, and page numbering at the top and bottom of all pages when you mix landscape orientation with portrait.
Mixing text justification (left-center-right) on the same line; e.g., text...current date...page number.
Numbering the lines inside WordPerfect columns - Use this trick with the newspaper column format.
Some related macros
1FORMAT - One-stop page and paragraph formatting
DYNAHEAD - Dynamic headers (a/k/a "running heads" or "floating headers") -- i.e., headers that change page-to-page with the section, topic, or heading on the same page
EMPTYPGS - Clean up empty pages (suppress numbering on blank pages, etc.)
SUPPRESS the appearance of page numbers (and some other items) on a specific page.
SUPDELAY - Automatically set up "second pages" with "page identifiers" using Suppress and Delay codes (via a macro).
Delay codes are actually made up of two codes:
The first code (shown as [Delay] in Reveal Codes) tells WordPerfect what to do; the second code ([Delay Codes]) code appears on the page where WordPerfect should start doing it.
Double-click the first code of the pair to open the full-size Define Delay Codes window. [You can use Edit, Find and Replace, Match, Codes to search for the first code of each pair.] Make sure Reveal Codes is open so you can see what is inside the [Delay] code.
Page numbering codes (there can be up to 7 varieties) begin with "Pg Num" (e.g., [Pg Num Disp]). As noted above you can use a macro found on the Toolbox site (DelCodes.wcm) to quickly remove any or all of these codes which are not inside a Delay code. (Macros, like the Find and Replace feature on the Edit menu, cannot search inside Delay codes or Style codes. Hence if you wish to deal only with page numbering codes you will need to locate any [Delay] codes and look inside them.)
For more on Delay codes see here.
Here is a simple macro to count the physical pages in a document.
To copy this code into your WordPerfect program to create a working macro, see here.
// Macro begins
Until(?RightChar="" and ?RightCode=0)
Messagebox(;;"Total physical pages in document: " + vPgs)
Procedure pExitSubstructures ()
// Exit from any header, footer, footnote, endnote,
// text box, graphic caption, etc.:
If ((vSubDoc=10) or (vSubDoc=11))
If (vBoxType=1 or vBoxType=3) BoxEnd (Save!) Endif
// Macro ends
[For macro writers -- continued from above]
Insert numbering codes in a document with a macro
Here's an 3-line example snippet of macro code that inserts a custom page numbering format and its number position, starting on the current page of a document (snippet demonstrated by Charles Cork on OfficeCommunity.com).
vTitle := "Document 1, Page "
PageNumberFormat (Format: vTitle + "[Page #]") // (<- insert actual code here)
PageNumberPosition (Position: TopCenter!; Default: DontUseDefaultValues!)
Note that you must replace the text placeholder (in blue) between the quote marks with the actual binary code from the Codes button ("Other" tab) on the Macro Toolbar. [Alternatively you can use this command: PageNumberFormat (Format: vTitle + NToC(63776)).]