manpagez: man pages & more
info emacs
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

30.13.9 Conversion Between Plain Text and Tables

The command table-capture captures plain text in a region and turns it into a table. Unlike table-recognize (see section Table Recognition), the original text does not have a table appearance but may hold a logical table structure. For example, some elements separated by known patterns form a two dimensional structure which can be turned into a table.

Here's an example of data that table-capture can operate on. The numbers are horizontally separated by a comma and vertically separated by a newline character.

 
1, 2, 3, 4
5, 6, 7, 8
, 9, 10

Invoking M-x table-capture on that text produces this table:

 
+-----+-----+-----+-----+
|1    |2    |3    |4    |
+-----+-----+-----+-----+
|5    |6    |7    |8    |
+-----+-----+-----+-----+
|     |9    |10   |     |
+-----+-----+-----+-----+

The conversion uses ‘,’ for the column delimiter and newline for a row delimiter, cells are left justified, and minimum cell width is 5.

The command table-release does the opposite of table-capture. It releases a table by removing the table frame and cell borders. This leaves the table contents as plain text. One of the useful applications of table-capture and table-release is to edit a text in layout. Look at the following three paragraphs (the latter two are indented with header lines):

 
table-capture’ is a powerful command, but mastering its
power requires some practice.  Here are some things it can do:

Parse Cell Items      By using column delimiter regular
                      expression and raw delimiter regular
                      expression, it parses the specified text
                      area and extracts cell items from
                      non-table text and then forms a table out
                      of them.

Capture Text Area     When no delimiters are specified it
                      creates a single cell table.  The text in
                      the specified region is placed in that
                      cell.

Applying table-capture to a region containing the above three paragraphs, with empty strings for column delimiter regexp and row delimiter regexp, creates a table with a single cell like the following one.

 
+-----------------------------------------------------------------+
|‘table-capture’ is a powerful command, but mastering its         |
|power requires some practice.  Here are some things it can do:   |
|                                                                 |
|Parse Cell Items      By using column delimiter regular          |
|                      expression and raw delimiter regular       |
|                      expression, it parses the specified text   |
|                      area and extracts cell items from          |
|                      non-table text and then forms a table out  |
|                      of them.                                   |
|                                                                 |
|Capture Text Area     When no delimiters are specified it        |
|                      creates a single cell table.  The text in  |
|                      the specified region is placed in that     |
|                      cell.                                      |
+-----------------------------------------------------------------+

By splitting the cell appropriately we now have a table consisting of paragraphs occupying its own cell. Each cell can now be edited independently without affecting the layout of other cells.

 
+-----------------------------------------------------------------+
|‘table-capture’ is a powerful command, but mastering its         |
|power requires some practice.  Here are some things it can do:   |
+---------------------+-------------------------------------------+
|Parse Cell Items     |By using column delimiter regular          |
|                     |expression and raw delimiter regular       |
|                     |expression, it parses the specified text   |
|                     |area and extracts cell items from          |
|                     |non-table text and then forms a table out  |
|                     |of them.                                   |
+---------------------+-------------------------------------------+
|Capture Text Area    |When no delimiters are specified it        |
|                     |creates a single cell table.  The text in  |
|                     |the specified region is placed in that     |
|                     |cell.                                      |
+---------------------+-------------------------------------------+

By applying table-release, which does the opposite process, the contents become once again plain text. table-release works as a companion command to table-capture.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.