Microsoft KB Archive/72117

= WD: How to Convert WordPerfect Merge Data Documents to Word =

Article ID: 72117

Article Last Modified on 8/15/2007

-

APPLIES TO


 * Microsoft Word 98 for Macintosh
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 1.0 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 1.1 Standard Edition
 * Microsoft Word 2.0 Standard Edition
 * Microsoft Word 2.0a
 * Microsoft Office Word 2003
 * Microsoft Word 2.0c
 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 4.0 for Macintosh
 * Microsoft Word 5.0 for Macintosh
 * Microsoft Word 5.1 for Macintosh
 * Microsoft Word 5.1 for Macintosh
 * Microsoft Word 6.0 for Macintosh
 * Microsoft Word 6.01 for Macintosh

-



This article was previously published under Q72117





SUMMARY
Microsoft Word 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 6.x or later, provided the WordPerfect 6.x import converter has been installed. However, the format of an imported secondary file is not valid as a Word 6.x data document unless you edit it prior to performing a mail merge.

Word 6.x and later support 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 6.x and later can use the imported secondary file in a mail merge. To use a WordPerfect 5.x secondary file, simply open the file in Word 6.x or later, or access the file in a mail merge.

The following Word programs do not support direct conversion of WordPerfect 5.x secondary files and require a workaround:


 * Word for Windows versions earlier than 6.0
 * Word for the Macintosh versions earlier than 6.0

WordPerfect 5.x Secondary files and Word 6.x and Later
Word 6.x and later versions automatically detect and convert 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 simply open the file in Word 6.x or later, or access the file in a mail merge.

Secondary files containing 31 fields or fewer become tables, and those with more than 31 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 5.x Secondary Files and Versions of Word Earlier Than 6.x
Versions of Word earlier than 6.x do not support conversion of WordPerfect 5.x secondary merge files.

When converting a secondary file from WordPerfect, the document text and layout will be retained, but merge commands appearing within braces (for example, {FIELD NAMES}, {END FIELD}, and {END RECORD}) are lost. The WordPerfect secondary document layout is not a valid data document layout for Word

WordPerfect 6.x Secondary Files and Word 6.x and Later
Word for Windows versions 6.x and later 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 converting the WordPerfect 6.x secondary file, the document text and layout will be retained, but merge commands appearing within braces (for example, {FIELD NAMES}, {END FIELD}, and {END RECORD}) are lost.

NOTE: Word for Windows version 6.x users will need to obtain the WordPerfect 6.x for Windows import text converter, which is supplied on the Supplemental WordPerfect Conversions Kit disk.

WordPerfect 6.x Secondary Files and Versions of Word Earlier Than 6.x
Versions of Word earlier than 6.x do not support direct conversion of WordPerfect 6.x files. You must save the WordPerfect 6.x file in an intermediary format, such as the version of Word being used, an earlier WordPerfect format, or Rich Text Format (RTF), before you can open it in Word

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


 * A WordPerfect 5.x secondary file into versions of Word earlier than 6.x

-or-
 * A WordPerfect 6.x secondary file into any version of Word.

Method 1: Use If You Have Access to WordPerfect:

Create a new primary document in WordPerfect 5.x or 6.x such 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 appropriate method 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 (&quot;), click Merge on the Tools menu and select Field. In the Insert Merge Code Box, type a 1 (The 1 corresponds to the first field and so on) click OK. The result is the text &quot;{Field}1~ in the document. Type one quotation mark which encloses the field in quotes 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 such 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 <HARD RETURN> represents pressing ENTER once):

&quot;{Field}1~&quot;,&quot;{Field}2~&quot;,&quot;{Field}3~&quot;<HARD RETURN>

</li> To merge the previously created secondary file, choose Merge from 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, click the Clear button if it is available. Place the cursor in the Find What box, type ^d. Clear any text or spaces in the Replace With box. Click Replace All and close the Replace dialog.</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 the ENTER key and type the name of each field. Enclose each field name in quotation marks and separate it with commas. Be sure not to forget to type any of the names of the fields. There should be as many field names are there were {END FIELD} codes for a record in the WordPerfect secondary file. An example of the first line of text (called a header record followed by data might look like:

&quot;firstname&quot;,&quot;lastname&quot;,&quot;address&quot;,&quot;city&quot;,&quot;state&quot;,&quot;zip&quot;<HARD RETURN>

&quot;Jane&quot;,&quot;Doe&quot;,&quot;One Main Street&quot;,&quot;Seattle&quot;,&quot;WA&quot;,&quot;98101&quot;<HARD RETURN>

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.

You can use this document as a Word data document in a print merge.</li></ol>

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 6.x or later 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 (&quot;).</li> Click Insert Field and 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 you insert in quotation marks, but should not follow it with a comma.</li> <li>After inserting all the field names such that they are enclosed in quotes and separated by commas, press ENTER once. An example of the file might look like follows (note that ENTER was pressed once only after the last field name was inserted):

&quot;FIELD(firstname)&quot;,&quot;FIELD(lastname)&quot;,&quot;FIELD(address)&quot;, &quot;FIELD(city)&quot;,&quot;FIELD(state)&quot;,&quot;FIELD(zip)&quot;<HARD RETURN>

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 the insertion point before the double quote 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 quotes and separated by commas. Be sure not to forget to type any of the names of the inserted fields. An example of a one record data file might look like:

&quot;firstname&quot;,&quot;lastname&quot;,&quot;address&quot;,&quot;city&quot;,&quot;state&quot;,&quot;zip&quot;<HARD RETURN> &quot;Jane&quot;,&quot;Doe&quot;,&quot;One Main Street&quot;,&quot;Seattle&quot;,&quot;WA&quot;,&quot;98101&quot;<HARD RETURN>

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

You can use the resulting document as a Word 6.x or 7.0 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 the non printing characters have been noted in brackets, follows: <pre class="fixed_text">  First {TAB} Last {TAB} Address {TAB} City {TAB} State {TAB} Zip {HARD RETURN} Sam {TAB} Elliot {TAB} 3499 Green Hills Rd. {TAB} Beverly Hills {TAB} CA {TAB} 98830 {HARD RETURN} Kate {TAB} Simmons {TAB} 1104 Calvary St. {TAB} Hampton {TAB} VA {TAB} 11101 {HARD RETURN} 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 the TAB key 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 cursor at that location, and insert a tab as a placeholder.</li> <li>Go to Page Setup and change the paper size to custom, 20&quot; width and 20&quot; length.</li> <li> On the Edit menu, click Replace, and replace Page Breaks with two percent signs. Click Replace All. <pre class="fixed_text">  Find What:        ^d        (NOTE: Type ^m in Word 6.X and later.)

Replace With:    %% </li> <li> On the Edit menu, click Replace, and replace paragraph markers with nothing. Click Replace All. <pre class="fixed_text">  Find What:        ^p

Replace With: </li> <li> On the Edit menu, click Replace, and replace the two percent signs with a paragraph marker. <pre class="fixed_text">  Find What:        %%

Replace With:    ^p </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 Sam Elliott   3499 Green Hills Rd.   Beverly Hills   CA  98830 Kate Simmons  1104 Calvary St.       Hampton         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>Once 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 Microsoft 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 will 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: <pre class="fixed_text">  FIELDNAMES(Name;Address)ENDRECORD (Hard Page Break) Mary Jane DoeENDFIELD Seattle, 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, 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: <pre class="fixed_text">  {FIELD NAMES}Name~Address{END RECORD} (Hard Page Break) Mary Jane Doe{END FIELD} Seattle, 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 could 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 would instead appear as: <pre class="fixed_text">     {FIELD NAMES} Name~ Address~ ~{END RECORD} {Hard Page Break} Mary Jane Doe{END FIELD} Seattle, Washington{END FIELD} {END RECORD} </li> <li> You could 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 would instead appear as: <pre class="fixed_text">     {FIELD NAMES}Name~Address{END RECORD} (Hard Page Break) Mary Jane Doe{END FIELD}Seattle, Washington{END FIELD}{END RECORD} </li> <li> You could reverse the layout of both field names and field entries. In such a case, the example above would instead appear as: <pre class="fixed_text">     {FIELD NAMES} Name~ Address~ ~{END RECORD} (Hard Page Break) Mary Jane Doe{END FIELD}Seattle, Washington{END FIELD}{END RECORD} </li> <li>You could not include any field name definitions in the secondary merge document, and instead simply 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 would appear by default as:

Mary Jane Doe{END FIELD}

Seattle, 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: <pre class="fixed_text">  ^N Name^R Address^R ^E Mary Jane Doe^R Seattle, Washington^R ^E This layout, with the exception of the differing merge commands, is the same as that used by the more recent 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 at the following address:

567 E. Timpanogos Parkway

Orem, UT 84097

Phone:(801) 765-4022.

Web: http://www.corel.com/servlet/Satellite?pagename=Corel3/Products/Display&pfid=1047024307359

The third-party contact information included in this article is provided to help you find the technical support you need. This contact information is subject to change without notice. Microsoft in no way guarantees the accuracy of this third-party contact information.

The WordPerfect products included here are manufactured by Corel Corporation, a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.

<div class="references_section">