Here is a WordPerfect 9+ macro that
counts all lines in the current document's body text area (including
table rows) that have text in them (i.e., alphanumeric characters).
Note that it does not count lines that contain only
punctuation, space characters, or graphics/text boxes, since these are
not normally considered "lines."
may have noticed that WordPerfect has a couple of built-in line
counters, of sorts.
(1) In recent versions, click on File, Properties, Word Count (tab). Note that this counts lines that might
only contain space chaacters.
(2) You also can go to the top of a document
- click on Format, Line, Numbering;
- check the box "Turn line numbering on";
- un-check both "Restart numbering on each page" and "Count blank
This gives line numbering in the left margin, with the last
numbered line showing what is in effect the total number of lines.
you no longer need it, delete the [Ln Num] code from the Reveal Codes
However, the LineCounter.wcm macro shows a
message onscreen that gives -
- the total line count (see paragraphs below for exclusions);
- the total number of lines (i.e., some lines
may be blank or contain just spaces or punctuation marks);
- a word count;
- a line count based on the traditional 65
characters (including spaces) per line.
There is no menu. Just play the macro in your
document and it will count the lines in it.
Be sure to play the macro
again if you edit or reformat the document, or if you select or use a
different printer. These may
cause the number of lines to change. With respect to printers,
WordPerfect makes heavy use of Windows printer drivers to format text,
which in turn can cause slight differences in document formatting if
the document is automatically or manually reformatted for a different
WordPerfect's Format, Line,
Numbering line count will include a count of any text
box/graphic image on a line, as well as lines with nothing by space
characters or punctuation marks in them. This macro does not count
these items as 'text' lines unless they include alphanumeric characters
on the same line. (However, the "traditional" 65
characters-per-line method mentioned above does include spaces.)
□ Some thoughts about line count
Line counting in the old "typewriter
days" was easier than it is today. You could depend on material in the
lines not moving, since what you typed was immediately set firmly on
paper. With computers, you have a choice between using typewriter-like
monospaced fonts and typeset-like proportional fonts. The latter can
produce problems when you try to count lines to get an accurate total.
Using a proportional font means that if
you select a different printer (File, Print, <printer name>)
or load the document on a different system with a different printer
attached, the new Windows printer driver can (and most likely will)
change the number of lines slightly due to inter-letter and inter-word
Furthermore, in WordPerfect there is a
setting in Tools, Settings, Environment that forces WordPerfect to
reformat documents (when opening them) to the current default printer's
specifications. This will surely make minor changes to the line count
on larger documents. Hence, WordPerfect will adjust lines to fit the
new printer driver specifications. [This frequently happens with
documents faxed from inside WordPerfect. The Windows (or fax software)
fax driver -- much like a printer driver -- wraps words to suit its
format requirements. As a result, a 'one-page fax' created in
WordPerfect can run over onto the next page when faxed. This is a good
reason to preview faxes before sending them!]
All of this is accomplished automatically
in WordPerfect using printer metrics (i.e., measurements).
According to the WordPerfect Help file (which section does not apply to WordPerfect 8 and
". . . By default, WordPerfect
determines line endings through printer metrics. If you will be moving
a document between different printers often, you may wish to prevent
the document from reformatting every time you change printers. You can
do this by disabling printer metrics. When you disable printer metrics,
WordPerfect determines line endings by display metrics.
To disable printer metrics (in WP9 and later
1. Click Tools, Settings.
2. Click Convert.
3. Click the Compatibility tab.
4. In the Options section, enable the "Don't use printer metrics to
format document" (or in WP10+, "Do not format document using printer
metrics") check box.
Note: If you disable printer
metrics, printer fonts will not be visible in your list of fonts."
This setting uses a 1200 dpi (dots per
inch) 'virtual printer,' and then sends the document to the physical
printer formatted to match the screen display pagination. This process
effectively removes reformatting / repagination problems.
So line count 'accuracy' is relative,
depending on several factors and system settings. If the line count is
made on the same system and the same printer where the document
was physically printed, there should be no problem or discrepancy.
However, it the line count is done first (for invoicing a client, as a
transcriptionist might do), and the .WPD file is then sent to a client
who prints it on their own system, the client might find that the line
count is off a bit.
I can't see any way around that, other
than to send a hard copy with the built-in line count feature turned
on, showing line numbers in the left margin. (To use this feature, go
to the top of a document and use Format, Line, Numbering, then check
"Turn line numbering on," and un-check both "Restart numbering on each
page" and "Count blank lines." This gives line numbering in the left
margin, with the last numbered line showing what is in effect the total
number of lines. When you no longer need it, delete the [Ln Num] code
from the Reveal Codes window.)
I think a word count is a more accurate
means of measuring production. But I see lots of people on the Corel
newsgroups and elsewhere trying to find ways to quickly and accurately
count lines in a document, so there must be a need for this. Hence, the
reason I wrote the LINECNTR macro.
See this site's Disclaimer, which is particularly
applicable if you depend on absolute accuracy in line counts.
- You could use SelectLineEnd in place of the
first two commands (SelectMode(On!) And PosLineEnd) in the macro's main
Repeat loop. However, in WP10 and later, a new checkbox exists in
Tools, Settings, Environment: "Use WP9 text selection." If this is left
un-checked (the shipping default), it will change the way SelectLineEnd
(and several other selection and cursor movement commands) works
compared to WP9 and earlier versions. The method used in this macro
circumvents this potential problem.
- You can use the values stored in vCount,
vTotCount, and vWordCount to print a report.