7 There are two types of tables with different syntax, `Grid Tables <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables>`_, and `Simple Tables <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#simple-tables>`_.
12 `Grid Tables <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables>`_ are described with a visual grid made up of the characters "-", "=", "|", and "+". The hyphen ("-") is used for horizontal lines (row separators). The equals sign ("=") may be used to separate optional header rows from the table body. The vertical bar ("|") is used for vertical lines (column separators). The plus sign ("+") is used for intersections of horizontal and vertical lines.
14 Here is example code for a grid table in a *.rst* file:
16 .. code-block:: console
18 +------------------------+------------+----------+----------+
19 | Header row, column 1 | Header 2 | Header 3 | Header 4 |
20 | (header rows optional) | | | |
21 +========================+============+==========+==========+
22 | body row 1, column 1 | column 2 | column 3 | column 4 |
23 +------------------------+------------+----------+----------+
24 | body row 2 | Cells may span columns. |
25 +------------------------+------------+---------------------+
26 | body row 3 | Cells may | - Table cells |
27 +------------------------+ span rows. | - contain |
28 | body row 4 | | - body elements. |
29 +------------------------+------------+---------------------+
31 This example code generates a grid table that looks like this:
33 +------------------------+------------+----------+----------+
34 | Header row, column 1 | Header 2 | Header 3 | Header 4 |
35 | (header rows optional) | | | |
36 +========================+============+==========+==========+
37 | body row 1, column 1 | column 2 | column 3 | column 4 |
38 +------------------------+------------+----------+----------+
39 | body row 2 | Cells may span columns. |
40 +------------------------+------------+---------------------+
41 | body row 3 | Cells may | - Table cells |
42 +------------------------+ span rows. | - contain |
43 | body row 4 | | - body elements. |
44 +------------------------+------------+---------------------+
50 `Simple tables <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#simple-tables>`_ are described with horizontal borders made up of "=" and "-" characters. The equals sign ("=") is used for top and bottom table borders, and to separate optional header rows from the table body. The hyphen ("-") is used to indicate column spans in a single row by underlining the joined columns, and may optionally be used to explicitly and/or visually separate rows.
52 Simple tables are "simpler" to create than grid tables, but are more limited.
54 Here is example code for a simple table in a *.rst* file.
56 .. code-block:: console
67 This example code generates a simple table that looks like this: