Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

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 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. Look at the numbers below. 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

When you invoke M-x table-capture on the above three-line region, the region can be turned into the next table:

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

where ‘,’ is used for a column delimiter regexp, a newline is used for a row delimiter regexp, 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 however mastering its power
     requires some practice.  Here is a list of items what 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 however mastering its      |
     |power requires some practice.  Here is a list of items what 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 however mastering its      |
     |power requires some practice.  Here is a list of items what 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.


 
 
  Published under the terms of the GNU General Public License Design by Interspire