Microsoft KB Archive/211702

= WD2000: How to Convert WordPerfect Merge Data =

Article ID: 211702

Article Last Modified on 12/6/2000

-

APPLIES TO


 * Microsoft Word 2000 Standard Edition

-



This article was previously published under Q211702





SUMMARY
Microsoft Word 2000 supports conversion of WordPerfect 5.x secondary merge files, but not conversion of WordPerfect 6.x secondary merge files.



MORE INFORMATION
A WordPerfect 6.x document can be opened in Word 2000, provided the WordPerfect 6.x import converter has been installed. However, the format of an imported secondary file is not valid as a Word data document unless you edit it prior to performing a mail merge.

Word supports direct conversion of secondary files from WordPerfect 5.0 and 5.1 for MS-DOS and WordPerfect 5.1 and 5.2 for Windows. Word can use the imported secondary file in a mail merge. To use a WordPerfect 5.x secondary file, just open the file in Word, or access the file in a mail merge.

For additional information about the text converters that are installed during a setup of Word 2000, click the article number below to view the article in the Microsoft Knowledge Base:

236051 WD2000: Text Converters Installed During an "Install Now" Setup

WordPerfect 5.x Secondary Files and Word 2000
Word automatically detects and converts WordPerfect 5.x secondary merge files to Word data source document format, provided the appropriate text converter is installed. To open the WordPerfect 5.x secondary file, just open the file in Word, or access the file in a mail merge.

Secondary files containing 63 fields or fewer become tables, and those with more than 63 fields become tab-delimited data documents. WordPerfect conditional print merge constructs and macros are not retained. WordPerfect {END FIELD} and {END RECORD} merge commands must be properly placed in a WordPerfect file, or field data may be placed in the wrong column or row after conversion to Word.

WordPerfect 6.x Secondary Files and Word 2000
Word can open a WordPerfect 6.x secondary file if the WordPerfect 6.x import converter has been installed. However, the file will be interpreted as a normal WordPerfect document.

When you convert the WordPerfect 6.x secondary file, the document text and layout are retained, but merge commands appearing within braces (for example, {FIELD NAMES}, {END FIELD}, and {END RECORD}) are lost.

How to Import a WordPerfect Secondary File
Use the appropriate method below to import.

Method 1: Use If You Have Access to WordPerfect:
Create a new primary document in WordPerfect 5.x or 6.x so that when it is merged with the secondary file, the resulting merged file is in a valid data document format that Word can use in a print merge. Use the method appropriate for your version of WordPerfect to accomplish this.

'WordPerfect 5.x:'  Open the secondary file in WordPerfect and determine whether the records are in the correct format. Each record should appear on a separate page and should have the same number of {END FIELD} codes. If any record contains fewer {END FIELD} codes than any other record, the record contains fewer data categories than the other records. This format causes an error if used in a Word merge unless an {END FIELD} code is inserted as a place holder for each missing data category of information in each record. Create a new WordPerfect document. Type one quotation mark ("), click Merge on the Tools menu, and select Field. In the Insert Merge Code box, type 1 (the 1 corresponds to the first field and so on), and click OK. The result is the text "{Field}1~" in the document. Type one quotation mark, which encloses the field in quotation marks, and type a comma in order to separate the field from the next field that will be inserted. Do not press the ENTER key between fields. Repeat steps 3 through 5 for each field in the secondary file. You should also enclose the last field that is inserted in quotation marks; it should not be followed by a comma.</li> After inserting all the fields so that they are enclosed in quotation marks and separated by commas, press ENTER once and save the file with the name Newmain.wpd. An example of the file might look like (where ¶ represents a paragraph mark by pressing ENTER.):

"{Field}1~","{Field}2~","{Field}3~"¶

</li> To merge the previously created secondary file, click Merge on the Tools menu, select Merge, type the name of the new primary file, Newmain.wpd, in the Primary File box, type the name of the existing secondary file in the Secondary File box, and click OK.</li> Save the file with a new name, and then open the file in Word.</li> If the first line of text in the merged file contains text other than actual data, select the entire first line of text and press ENTER once. (This deletes the existing first line of text and moves the data to the first line in the file.)</li> Click Replace on the Edit menu, and click the Clear button if it is available. Place the insertion point in the Find what box, and type ^d. Clear any text or spaces in the Replace with box. Click Replace All and close the Replace box.</li> Place the insertion point at the beginning of the document in front of the quotation mark before the first record, and press ENTER once. Move the insertion point back up to the empty paragraph that was created by pressing ENTER, and type the name of each field. Enclose each field name in quotation marks, and separate it with commas. Be sure to type all the names of the fields. There should be as many field names as there are {END FIELD} codes for a record in the WordPerfect secondary file.

For example, the first line of text (called a header record followed by data) might look like:

"firstname","lastname","address","city","state","zip"¶

"Judy","Lew","One Main Street","Seattle","WA","98101"¶

No spaces, punctuation, slashes, or dashes are allowed in the header record. No blank lines or text should appear before the header record.</li> Save the file.</li></ol>

You can use this document as a Word data document in a print merge.

'WordPerfect 6.x:'

NOTE: If the WordPerfect 6.x secondary file is in a table format rather than a text format, you can open the file in Word with the WordPerfect 6.x import converter, and you do not need to follow the steps below. You can use the data file after removing the extra paragraphs in each of the table cells. <ol> Create a new WordPerfect document.</li> On the Tools menu, click Merge, and then click Form.</li> In the Associate a data file box, type the name of the previously created data document, and click OK.</li> Type one quotation mark (").</li> Click Insert Field, and then select and insert a field in the list.</li> Type another quotation mark to enclose the field in quotation marks. Then type one comma .</li> Type another quotation mark, select another field, and insert it.</li> Type another quotation mark, and type a comma.</li> Repeat steps 7 and 8 for each field. You should also enclose the last field that you insert in quotation marks, but do not follow it with a comma.</li> <li>After inserting all the field names so that they are enclosed in quotation marks and separated by commas, press ENTER once. For example, the file might look as follows (note that ENTER was pressed once only after the last field name was inserted):

"FIELD(firstname)","FIELD(lastname)","FIELD(address)","FIELD(city)","FIELD(state)","FIELD(zip)"¶

No spaces, punctuation, slashes, or dashes are allowed in the header record. No blank lines or text should appear before the header record.</li> <li>Click Merge, and then click Merge in the dialog box.</li> <li>Click Options, and click to clear the Separate Each Merged Document with a Page Break option. Click OK twice.</li> <li>Place the insertion point before the quotation mark in front of the first word in the document and press ENTER.</li> <li>Move the insertion point back to the first blank paragraph created in the previous step, and type the name of each field where each field name is enclosed in quotation marks and separated by commas. Be sure to type all of the names of the inserted fields. For example, a one-record data file might look as follows:

"firstname","lastname","address","city","state","zip"¶

"Judy","Lew","One Main Street","Seattle","WA","98101"¶

</li> <li>Save the file.</li></ol>

You can use the resulting document as a Word 2000 data document in a print merge. If you have an earlier version of Word, save the file in an intermediary format, such as the version of Word being used, an earlier WordPerfect format, or Rich Text Format.

Method 2: Use If You Do Not Have Access to WordPerfect:
It is possible to clean up a WordPerfect 5.x or 6.x for Windows data document in Word after converting the file directly from WordPerfect format. However, due to the number of possible variations to the layout of a WordPerfect data document and the complexity and variations that are required in a clean-up macro, this method is recommended only if you do not have access to WordPerfect and cannot use method 1.

A valid Word data file must be either a comma- or tab-delimited file, or must be formatted as a table. If a delimited document is used, the delimiter must separate each category of information (or data field) for each record. Each record must have the same number of delimiters, and each record must be separated from the next record by a hard return.

If a table is used, data field information must appear in a separate table cell, and each row (which corresponds to a singe record) must have the same number of cells. Both types of data files must contain a header record, which lists all the field names that identify the data field categories. An example of a two-record tab-delimited data file (where ¬ represents a tab character by pressing TAB) follows:

First ¬ Last ¬ Address ¬ City ¬ State ¬ Zip¶

Peter ¬ Kelly ¬ 1234 Elm Rd. ¬ Anytown ¬ WA ¬ 98830¶

Judy ¬ Lew ¬ 1111 Mystreet St. ¬ Someplace ¬ VA ¬ 11101¶

The following method uses the Replace command to arrange a converted WordPerfect data file for use in Word. <ol> <li>Open the WordPerfect secondary merge file in Word.</li> <li>View the document and determine whether the records are in the correct format. Each record should appear on a separate page and should have the same number of tabs. (Turn on non-printing characters if you cannot see tabs, which look like gray arrows.) If a record contains a paragraph mark that is not at the end of the last field but is between data fields, delete the paragraph and press TAB once. If a record has fewer tabs than any other record, the record contains fewer data categories than the other records. You must determine which data category is missing in the record, place the pointer at that location, and insert a tab as a placeholder.</li> <li>On the File menu, click Page Setup, and change the paper size to Custom size, 20" width and 20" length.</li> <li>On the Edit menu, click Replace. In the Find what box, type ^m. In the Replace box, type: %%. Click Replace All.</li> <li>On the Edit menu, click Replace. In the Find what box, type ^p. Leave the Replace box blank. Click Replace All.</li> <li>On the Edit menu, click Replace. In the Find what box, type: %%. In the Replace box, type: ^p. Click Replace All.</li> <li>Save the file with a new file name in order to preserve the original file. The file should now look like each line contains only one record. Each record should begin with the same field information.</li> <li> Insert a header record as the very first record in the data file, where each field name is separated from the others by a tab. A header record inserted at the top of a data file might appear like this (non-printing characters are not noted): <pre class="fixed_text">  name           address                city            state  zip Peter Kelly   1234 Elm Rd.           Anytown         WA     98830 Judy Lew      1111 Mystreet St.      Someplace       VA     11101 No spaces, punctuation, slashes, or dashes are allowed in the header record. No blank lines or text should appear before the header record. </li> <li>After the header record is inserted, save the file.</li></ol>

You can now use this file for a data file in a Word Mail Merge.

WordPerfect Mail Merge Formats
WordPerfect's secondary mail merge files are significantly different from Word for Windows, Word for the Macintosh, and Word for MS-DOS data documents. In WordPerfect, a data document (by default) aligns merge data down the left margin with each field on a separate line and each record separated by an end-of-record code. In all versions of Word, each record contains fields that are separated by delimiters, and each record is separated by a hard return.

The sections below describe the default layouts used by WordPerfect 5.1 for MS-DOS and WordPerfect 5.x and 6.x for Windows, as well as the somewhat different format used by WordPerfect 5.0 for MS-DOS. Possible manual variations of the default formats are also described.

WordPerfect 6.x Secondary Merge File Format
By default, a WordPerfect secondary text file created in WordPerfect 6.0 or 6.1 for Windows separates records by using the ENDRECORD merge command followed by a hard page break. The information in each record is divided into fields. Fields within each record are separated by the ENDFIELD merge command followed by a hard carriage return.

Fields may be referenced in a primary merge document by number or by name. Fields are automatically numbered by WordPerfect from top to bottom by default. If names are assigned to fields, these names appear in a record at the beginning of the secondary merge file preceded by the FIELDNAMES merge command.

Therefore, by default, a WordPerfect 6.x secondary merge file that includes field names appears similar to the following:

FIELDNAMES(Name;Address)ENDRECORD

(Hard Page Break)

Judy LewENDFIELD

Someplace, WashingtonENDFIELD

END RECORD

(Hard Page Break)

WordPerfect 5.x Secondary Merge File Format
By default, a WordPerfect secondary file created in WordPerfect 5.1 for MS-DOS or WordPerfect 5.1 or 5.2 for Windows separates records by using the {END RECORD} merge command followed by a hard page break. The information in each record is divided into fields. Fields within each record are separated by the {END FIELD} merge command followed by a hard carriage return.

Fields may be referenced in a primary merge document by number or by name. Fields are automatically numbered by WordPerfect from top to bottom by default. If names are assigned to fields, these names appear in a record at the beginning of the secondary merge file preceded by the {FIELD NAMES} merge command.

Therefore, by default, a WordPerfect 5.1 or 5.2 secondary merge file that includes field names appears similar to the following:

{FIELD NAMES}Name~Address{END RECORD}

(Hard Page Break)

Judy Lew{END FIELD}

Someplace, Washington{END FIELD}

{END RECORD}

(Hard Page Break)

You might choose to manually manipulate the layout of a secondary merge document in WordPerfect. The following are some of the possible manual variations of the default layout: <ul> <li>You can insert hard returns following each field name at the beginning of a secondary merge document so that the field names appear aligned down the left column in the same manner as the actual field entries appear by default. In such a case, the example above instead appears as:

{FIELD NAMES}

Name~

Address~

~{END RECORD}

{Hard Page Break}

Judy Lew{END FIELD}

Someplace, Washington{END FIELD}

{END RECORD}

</li> <li>You can remove the hard returns that normally follow each {END FIELD} code so that each data record appears horizontally across the page in the same manner as the field names do by default. In such a case, the example above instead appears as:

{FIELD NAMES}Name~Address{END RECORD}

(Hard Page Break)

Judy Lew{END FIELD}Someplace, Washington{END FIELD}{END RECORD}

</li> <li>You can reverse the layout of both field names and field entries. In such a case, the example above instead appears as:

{FIELD NAMES}

Name~

Address~

~{END RECORD}

(Hard Page Break)

Judy Lew{END FIELD}Someplace, Washington{END FIELD}{END RECORD}

</li> <li>You could not include any field name definitions in the secondary merge document, and instead just make reference to each field in the primary document based on its field number. Depending on the horizontal or vertical (default) layout chosen for field entries, they are numbered in a record either from top to bottom or from left to right. In the example above, Name is field 1 and Address is field 2, and the secondary merge file appears by default as:

Judy Lew{END FIELD}

Someplace, Washington{END FIELD}

{END RECORD}

(Hard Page Break)

</li></ul>

WordPerfect 5.0 Secondary Merge File Format
By default, a WordPerfect secondary file created in WordPerfect 5.0 for MS-DOS separates records by using the Merge E command (^E followed by a hard page break). The information in each record is divided into fields. Fields within each record are separated by the Merge R command (^R followed by a hard return).

Fields can be referenced in a primary merge document by number or by name. WordPerfect automatically numbers fields from top to bottom by default. If names are assigned to fields, these names appear in a record at the beginning of the secondary merge file, preceded by the Merge N command (^N followed by a hard return).

Therefore, by default, a WordPerfect 5.0 secondary merge file that includes field names appears similar to the following:

^N

Name^R

Address^R

^E

Judy Lew^R

Someplace, Washington^R

^E

This layout, with the exception of the differing merge commands, is the same as that used by WordPerfect versions 5.1 and 5.2. The same possible variations of this layout as outlined for those versions above are applicable to WordPerfect 5.0.

Support for all versions of WordPerfect is the sole responsibility of Corel Corporation. For more information or support for the merge functionality of WordPerfect, contact Corel Customer Support.

For information about how to contact Corel, click the appropriate article number in the following list to view the article in the Microsoft Knowledge Base:

65416 Hardware and Software Third-Party Vendor Contact List, A-K

60781 Hardware and Software Third-Party Vendor Contact List, L-P

60782 Hardware and Software Third-Party Vendor Contact List, Q-Z

The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

<div class="references_section">