| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated May 25, 2020
Main tips page | Browse more tips
Merge tips for multi-page documents
Some related links -
[Note: Many of these tips also appy to merging single-page documents]
Formattng (fonts, pagination, spacing, etc.)
Two-tray merge printing (merging multiple-page letters using letterhead paper for page 1 and plain paper for subsequent pages)
Resetting margins, headers, footers, etc., in merged documents (merging multiple-page documents so that formatting is identical from record to record)
Producing correct page numbering, footnote/endnote numbering, and line/paragraph spacing with multiple-page merge forms
Method A: Modify the form document's initial style to force page numbering. note numbering, line spacing, etc.
Method B: Use a simple embedded macro in the form file.
Formattng (fonts, pagination, spacing, etc.)
Be sure to explicitly set your merge form's basic format and pagination codes at the top of the merge form document (.frm).
That way, when the second and subsequent merged documents in the merge queue are merged, any changes to formatting or pagination in the middle of the form document (or in a second form document) will be reset to their (user-defined) defaults for each document before it is merged with your data.
Notes and tips ...
1. "Top of the merge form document" usually means the very top of the body text area in the form document, not inside the initial [Open Style: DocumentStyle] code.
An exception is to use the [Open Style: DocumentStyle] code to reset page numbers to "1" as explained in the examples below, but this merely modifies the "top of the merge form document" rule.
On the other hand, other WordPerfect formatting codes can be placed inside the initial document code (see the "Resetting..." section below). Simply test the methods to see which works best for you.
2. If you have multiple form documents in your merge (e.g., a form letter and an invoice document), you should explicitly set format and pagination codes at the top of each merge form document so that each merged document "reads" the specified formatting codes before it merges that item.
Examples ...Two-tray merge printing
A user on a Corel newsgroup asked:
[Page Top]Resetting margins, headers, footers, etc., in merged documents
Several years ago a user on the WordPerfect Universe asked:
[Page Top]Producing correct page numbering, footnote/endnote numbering, and line/paragraph spacing with multiple-page merge forms
[...continued from above...]
[If you need to add paired codes (bold, italics, etc.) to just certain merged fields, see this post by Noal Mellott on WordPerfect Universe, which describes how to add these codes in appropriate places on the merge form.]
Here is the text of Noal Mellott's WordPerfect Universe post:
"When inserting formatting codes, in particular paired ones, be sure that the merge process encounters the code in the frm-file at a position before merging a field or record and that the Off-code, if any, is encountered immediately after merging it.
A practical example: Where might you place the Italics on/off codes in the following?
IFBLANK(5) FIELD(5) ELSE FIELD(6) ENDIF
To italicize any action taken:
[ItalicsOn] IFBLANK(5) FIELD(5) ELSE FIELD(6) ENDIF [ItalicsOff]
To italicize only the text inserted from field 5:
IFBLANK(5) [ItalicsOn] FIELD(5) [ItalicsOff] ELSE FIELD(6) ENDIF
To italicize only the text inserted from field 6:
IFBLANK(5) FIELD(5) ELSE [ItalicsOn] FIELD(6) [ItalicsOff] ENDIF
But what will happen if you use the following?
IFBLANK(5) [ItalicsOn] FIELD(5) ELSE FIELD(6) [ItalicsOff] ENDIF
In this case, if the merge encounters a fifth field with text it will turn italics on, and the italics will never be turned off until, when processing some later record, the merge encounters a blank fifth field and inserts the sixth field instead."
[continued from sidebar above...]
Want to use individual watermarks on several pages of a merge?
Sometimes this can be problematic. From this thread on WordPerfect Universe:
How to "hide" multiple [Watermark] images used in a multi-page merge.
Assume you have created three watermark images, each of a different page of a scanned paper form, separated by hard page breaks in the body text area of the document.
You want to merge data on top of each of the pages [i.e., directly over the watermark images] at the appropriate locations on each page, but you do not want the [Watermark] codes to be pushed away from their assigned locations by the merge data.
Step 1. Create the three watermark images. You can store them temporarily in a new, separate document. Open the separate document on screen so it is available; be sure to open Reveal Codes, too.
Step 2. Select the first watermark image (the one which should be seen on page 1 of the merge form); perhaps you can select the image's code in Reveal Codes (this is most easily done with <Shift+arrow>), or just right-click on it to choose "Select Box" or similar from the context menu that pops up. Copy the selection to the Windows clipboard with <Ctrl+C>.
Step 3. Open another new blank document. At the top, open a watermark window with Insert, Watermark; choose Watermark A, then click Create. In this new window, paste the copied image with <Ctrl+V>, then close the window with the "Close editor" icon on the property bar or with File, Close on the main menu. You should now see a new [Watermark A] code in Reveal Codes.
Step 5. Return to the new document (created in Step 3). Place your cursor after the [Watermark A] code in Reveal Codes if it is not already there.
You should see [Watermark A][Delay: 1] codes in Reveal Codes.
Step 6. Place the cursor after the two new codes (in Reveal Codes). Repeat Step 4 and Step 5, using the third image -- BUT in the Delay Codes dialog, enter a "2" in the "Number of pages to skip" field. [You want to delay image #3 to page 3.]
You should see [Watermark A][Delay: 1][Delay: 2] codes in Reveal Codes.
So far, so good.
You can now test the new document by adding a couple of hard page breaks (<Ctrl+Enter>) following (i.e., after) the [Watermark A][Delay: 1][Delay: 2] codes in Reveal Codes. This should produce a three-page document with the three images in sequence.
After testing, remove the two [HPg] codes, retaining just the [Watermark A][Delay: 1][Delay: 2] codes in Reveal Codes.
But ... you need to perform one more procedure or these new codes might get pushed down or be accidentally deleted during the merge:
Step 7. Hide the codes: Select just the three new [Watermark A][Delay: 1][Delay: 2] codes in Reveal Codes (this is most easily done with <Shift+arrow>), and cut them to the clipboard with <Ctrl+X>. [Cutting them removes them from the main document, which is exactly what we want to do.]
Step 8. Double-click on the [Open Style: DocumentStyle] code at the top of the document (or in any document you wish to use as the new merge form). This opens the Styles Editor for the document's default style.
Step 9. Paste the three codes into the Contents field (usually after all other codes) with <Ctrl+V>, then click OK. You should be back in the main document.
In the main document you should see the first image on the screen, on page 1 of the document. You can add two temporary page breaks (with <Ctrl+Enter>); the other two images should appear on pages 2 and 3. [Note: Be sure to remove the temporary [HPg] codes and anything else you might have added before the next step.]
Step 10. Finally, create (or copy) both your merge form's text and merge fields in the new document, on the relevant pages and page locations.
You can use borderless tables to help format the merge form itself, and/or Format, Typesetting, Advance for precise location control. Add a hard page break to separate each page.
[Step 10 alternate:] You might be able to simply insert the three new codes into the original merge form's [Open Style: DocumentStyle code] code, and delete the old [Watermark] and [HPg] codes. However, it seems less problematic -- maybe less confusing -- to start fresh with a new form document.
Reminder: Be sure to edit the initial style code (see Step 8) if you need to revise or delete the [Watermark] codes!
Strong suggestion: If you need to revise such hidden codes later, it is usually better to select the codes in the Contents pane of the Styles Editor (they were placed there in Steps 8-9 above), cut them (<Ctrl+X>) to a new blank document, edit them there, then paste them back into the same Contents pane. Why? Sometimes, trying to edit a format code that is located inside a style code will cause WordPerfect to freeze and force you to stop the program with <Ctrl+Alt+Delete>. Some codes encapsulated inside a style (via the Styles Editor) cannot be modified once they are in there, but you can edit them if they are temporarily moved into the body text area of a document.
[...continued from above...]
To divide a physical merge form into two or more "columns" so that the form's text and merged data flows down the columns (rather than, as sometimes happens, across the columns), here's a method contributed by Larry Lewis on WordPerfect Universe (here; slightly annotated) that sets up a "3-column" format using Avery's 3-across (#5160), full-height labels (selectable using Format, Labels):
1. Open the Label dialog (Format > Labels).
2. Hightlight the Avery 5160 Label.
3. Click "Create" button.
4. Under "Label description", give it a new name.
I named mine "!3 Column page". The exclamation mark lets it sort to the top of the list, making it easy to spot.
5. Under "Labels per page" changed "number of Rows" to from 10 to 1.
6. Under "Label size" changed "Height"from 1" to 10".
[Optional: Adjust Left/Right margin for desired "column" separation (e.g., Left = 0.1").]7. Clicked the OK button, and selected it.
Advantage of Labels over Columns; "Text Flow"
Advantage of Labels over Divide Page; "Margins".
Advantage of Labels over Tables; "Wrap". Text will flow from one Label to another, just like wrapping from one page to another. In a Table, text will NOT wrap cell to cell.
I love WP's Label format. I use it a lot for formatting, and the only problem I've run into is that a particular printer does not recognize the format I've created.
PS: When creating custom Labels, always try to start with an existing format that is close to your desired goal. ..."
Larry's great idea for a "3-column merge" works because WordPerfect considers each label as a separate logical page * -- not as a WordPerfect column.
Setting up the label format (as in his example) using 3-across Avery #5160 labels (but with each label set to be 10" high) gives you the equivalent of up to 3 "pages" of text on 1 physical sheet of paper.
Hence, Larry's label method sets up a form for a multi-page merge, where text "flow" is like any other page: from top to bottom on each page.
* From the LablCopy page in the Library about logical pages:
"... When you select a label definition with Format, Labels (generally when in a new, empty document window), WordPerfect internally defines the size and margins for each label and their location and spacing on the physical printout sheet.
However, when you create the first label on screen, it is really a "logical" page. WordPerfect's Help (under Glossary) defines a logical page this way:
A defined area inside a physical page (the sheet of paper you print on). You can have several logical pages on one physical page. For instance, if you are printing labels, the sheet or roll of labels is called the physical page; each individual label is called a logical page."
At the very end of the first label's text and codes, if you add a hard page break with <Ctrl+Enter>, you'll see the second (blank) label appear onscreen — right next to the first one. (Look at the status bar at the bottom of the WP window: It should say "Pg 2." It really means "Logical Pg 2, Physical Pg 1.") ..."