Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2021 by Barry MacDonnell. All Rights Reserved.

Page updated Dec 17, 2019

WordPerfect Tips
Main tips page | Browse more tips
How to convert text to a table -or- convert a table to text or to a merge data file


Related tips -

Using WordPerfect tables

Merge tips

Merge tips for multi-page documents

Sorting a table (then convert the sorted table back to text)




WordPerfect's online Help (F1 key, Search tab: "Convert text to a table" or "Creating a table by converting text") describes how to create a table from tabular text (text separated on each line by tabs, indents, or spaces), or text in parallel columns, or text in paragraphs. (See the Section 1 below.)

You can also do the reverse: E.g., convert a table to text, or to a merge data file. (See Section 2 below.)

Section 1.  Create a table by converting text

[Important: Some text to be converted might have used line break [Ln Brk] codes instead of hard return [HRt] codes to end the lines of text. (Sometimes this is done by the user with <Ctrl+Shift+L>, and sometimes it is done by the program when importing material from another source.) You should replace line breaks with hard returns (you can use Find and Replace to do it) before following the next steps.]

•  In WordPerefct X6 and other recent versions:

Use WordPerfect Help (F1) and in the Search tab: "Creating tables" or "Converting text to tables" or "Create a table by converting text".

For example:

Step 1. Select all contiguous lines of text where each line's individual items are separated by either tabs ([Left Tab]), indents ([Hd Left Ind]), space characters, or commas. Each line should end with a hard return ([HRt]). For example:

One[Left Tab]Two[Left Tab]Three[Left Tab]Four[Left Tab]Five[HRt]
Six[Left Tab]SevenLeft Tab]Eight[Left Tab]Nine[Left Tab]Ten[HRt]
... Etc.

Step 2. Click Table, Convert to bring up the "Convert: Text to Table" dialog.

Convert Text to Table dialog

Step 3. Choose the number of columns, etc., on the left side of the dialog. [This is an optional step in most cases since the program usually detects the necessary number of "columns" in the source text, as in the example above.]

Step 4. In the Text Delimiters area, enable the desired option.

For example:

▸  To convert items separated by commas (such as a .CSV file), where each line item (a.k.a., record) ends in a hard return, choose Commas.
[The number of columns in step #3 above should equal the number of comma-separated items in each row of text.]

▸  To convert items separated by tabs or indents (often used by typists to format separated items into "columns"), choose Tabs.

Hint:

For tab-(or indent-)separated material you can just use Step 1 and then use Table, Create from the main menu. This shortcut brings up the "Convert: Text to Table" dialog with Tabs selected (as in the image above). Just press Enter.

Caution:

The end of each line of material separated by tabs or indents should be terminated with a hard return (HRt) code (i.e., using the Enter key) -- not a line break (Ln Brk) code. The latter does not end a line, it continues it on the following line. Hence the resulting table would contain the tabbed material in a single, "glued together" row!

(Ctrl+z should Undo such an erroneous table structure. Use Reveal Codes to delete the [Ln Brk] codes and press Enter to replace them with hard returns. Then repeat the conversion steps above.)

▸  To convert line items (words, phrases, sentences, paragraphs, List items, etc.) that end with a hard return [HRt] or [Para Style], choose Paragraphs. (See also the Important note above.)

▸  To convert text items where each record's items are separated horizontally by single spaces (e.g., line items in data sheets) instead of tabs or indents, choose User Defined and type a space character (i.e., press the spacebar) in the adjacent field. (Tip: Multiple adjacent spaces in existing material can be reduced to single spaces with a macro such as DeSpacer.)

Step 5. Click OK.

Step 6. Optional - Divide the contents of table rows across pages:

To ensure that table cells with more than one line of text in them will split their contents onto the following page:

▸  Select the entire table.

▸  Right-click on the selection.

▸  Choose Format from the context menu that appears.

▸  In the "Properties for Table Format" dialog that appears, click on the Row tab in that dialog.

▸  Under "Row attributes" ensure there is a check mark Checkmarked box in the "Divide row across pages" box. (A check mark, not a solid black square inside the box, which indicates that one, or a few, rows are marked that way. A check mark will set all of that table's rows to divide their contents across pages whenever needed.)

▸  Also be sure that "Multiple lines..." is enabled in that dialog.

Tips

Table as a conversion tool: Once formatted as a table, the table can then be converted to another format with Table, Convert (such as into Comma Separated Value (CSV) format, paragraph separated text, merge data file (below), etc.).

☼ If you want to convert WordPerfect columns (i.e., text created with Format, Columns) to a table, first convert the columns to regular text by opening Reveal Codes and deleting the [Col Def] code at the beginning of the columns (this turns the columns into normal page text), then select the normal text and convert it to a table using Paragraph separators. Each paragraph will now be in a single row, but you can add (insert) another column and cut-and-paste material into the new cells.

Tables can be sorted easily. See "Using WordPerfect tables" for this and several other tips.

☼ See also "Creating a table from existing labels."

•  In some earlier WordPerfect versions:

Use WordPerfect Help (F1) and in the Search tab: "Create a table by converting text"

Step 1. Select the tabular text or parallel columns.

Step 2. Click Table. (In WordPerfect 9 and earlier, click Insert, Table.)

Step 3. Enable one of the following buttons:

   · Tabular Column - converts tabular text into a table
   · Parallel Column - converts parallel columns into a table

Tips

☼  If you have a document composed of text "fields" separated by commas (.CSV, or Comma Separated Values), you can replace the commas with tabs to create tabular text, and then convert the text to a table (as above): Use Find and Replace to replace all commas with a [Left Tab] code (use the Replace, Codes... menu choice to insert that particular tab code in the "Replace with" field).

What is not mentioned in the Help file is that you also can convert any group of items separated by hard returns ([HRt]) to a one-column table in the same way. (Choose the Tabular Column option after selecting the list.) This is a great way to turn a list of items into a table format.


Section 2.  Convert a table to text or a merge data file

•  In WordPerefct X5 and other recent versions:

Just place your cursor anywhere inside the table, then click Table, Convert... on the main menu. This opens another dialog with several options:

Convert tables to text
  ○  Separate text with commas
  ○  Separate text with paragraphs (hard returns)
  ○  Separate text with t
abs
  ○  Separate text with
other
Convert text to merge data file (.dat)
  □  Use text in first row as field names

Tips

☼  You can also do it this way: Open Reveal Codes and delete the [Tbl Def] code. A "Delete Table" dialog appears. You can then choose the option to Convert table contents and separate the columns with

☼  For a merge data text file, you probably want to first create a header row for Field Names. Just place the cursor in the top row, right-click there, and choose Insert, Rows [1], Before. Then enter the field names in that row.

Then when you use Table, Convert you can choose the option "Use text in first row as field names". [See also "Merge tips".]

☼  You can also use a data table file directly, as the source for a merge, as explained in WordPerfect's Help (F1) under "merge data, creating".

The first table row contains field names, subsequent rows contain the data records to merge, and column cells contain the particular field's data to merge for each record.

•  In some earlier WordPerfect versions:

Select the table (you can place your cursor anywhere in the table and click on Select Table, Select Table from the Table property bar), then click on Table, Delete from the property bar (or just right-click while inside the selected table and then click Delete on the context menu). A dialog will pop up; use one of the Table Structure or Convert Contents options to turn the table back into text or into a merge data file.