## Editing Tables

Amaya does not contain a separate table editor. To Amaya, a table is simply a structure described by the HTML document type definition (DTD), like any other element, and it is edited as such. The same commands apply to tables as to other HTML structures. However, a few specific commands have been added for more convenient manipulations.

### Creating a New Table

To create a new table:

1. Move the cursor to the location in the document where you want to create the table.
2. Click the Table button , or choose Table from the XHTML menu.The Table dialog displays.
3. Enter the initial number of rows and columns for the new table, and specify the border width.
4. Click the Confirm button. Amaya generates a graphical representation of the table.
5. The cursor is automatically placed in the space above the table that is reserved for the table caption. You can delete this space if a caption is not needed.
6. The new table contains empty cells. To insert content into a cell, click inside the cell and then insert the appropriate text, image, etc. Use the arrow keys to navigate from one cell to another.

### Adding a New Column

To add a new column to a table:

1. To create a new column to the left of an existing cell, select the Insert a column entry in the XHTML / Table sub-menu or type `Ctrl t Ctrl b`.
2. To create a new column to the right of an existing cell, select the Append a column entry in the XHTML / Table sub-menu or type `Ctrl t Ctrl a`.

New columns can also be easily added to a table using the Enter key. When a whole cell is selected (use `F2`), pressing the Enter key create a new cell and its corresponding column to the right of the selected cell.

### Removing, Copying, Pasting a Column

When a whole column is selected, you can delete it, copy it, cut it and paste it before or after another column.

To select a column:

1. Use the Select column entry in the Table sub-menu (`Ctrl t Ctrl c`).
2. You can also start the selection in a cell and extend to another cell in the same column (for example start in Cell 1.2 and stop in Cell 2.2). Amaya changes to column selection mode. Hitting the `F2` key twice extends the selection to the whole column.

Cell 1.1 | Cell 1.2 | Cell 1.3
Cell 2.1 | Cell 2.2 | Cell 2.3
Cell 3.1 | Cell 3.2 | Cell 3.3

When a whole column is selected, use the usual commands to copy, delete or cut it.

Two specific commands are vailable to paste a column:

1. To paste a column before an existing column, click at the beginning of a cell in the existing column and use item Paste before of the XHTML/Table sub-menu (`Ctrl t Ctrl p`).
2. To paste a column after an existing column, move the cursor to the end of a cell in the existing column and use item Paste after of the XHTML/Table sub-menu (`Ctrl t Ctrl v`).

### Adding a New Row

There are two specific commands to create new rows in a table:

1. To create a new row above an existing row, select Insert a row from the XHTML/Table sub-menu (`Ctrl t Ctrl i`).
2. To create a new row below an existing row, select Append a row from the XHTML/Table sub-menu (`Ctrl t Ctrl n`).

New rows can also be easily added to a table using the Enter key. When a whole row is selected (use key `F2` for that), pressing the Enter key create a new row after the selected row.

### Removing, Copying, Pasting a Row

When a whole row is selected, it's possible to delete it, to copy (or to cut) it and to paste it.

To select a row:

1. Use the Select row entry in the XHTML/Table sub-menu (`Ctrl t Ctrl r`).
2. You can also start the selection in a cell. Hitting the `F2` key extends the selection to the enclosing row.

When a whole row is selected, you can delete it, copy it, or cut it with the usual commands.

Two specific commands are available to paste a row:

1. To paste a row before an existing row, use the Paste before item of the XHTML/Table sub-menu (`Ctrl t Ctrl p`).
2. To paste a row after an existing row, use the Paste after item of the XHTML/Table sub-menu (`Ctrl t Ctrl v`).

### Extending a Cell

To extend a cell

1. To extend a cell to the next cell at the right, select Join with the cell at the right in the XHTML/Table sub-menu (`Ctrl t Ctrl e`).
2. To extend a cell to the next below, select Join with the cell below in the XHTML/Table sub-menu (`Ctrl t Ctrl j`).
3. To shrink the horizontal extension of the cell by one position, select Shrink horizontal extend in the XHTML/Table sub-menu (`Ctrl t Ctrl s`).
4. To shrink the vertical extension of the cell by one position, select Shrink vertical extend in the XHTML/Table sub-menu (`Ctrl t Ctrl m`).

Cell extensions can be also changed by editing the `colspan` and `rowspan` attributes.

### Adding a New Table body (tbody)

To create a new tbody:

1. To create a new table body above an existing table body, click at the beginning of the first cell in the first row of the table body and select the tbody item in the XHTML/Table sub-menu.
2. To create a new table body below an existing table body, move the cursor to the end of the last cell in the last row of the table body and select the tbody item in the XHTML/Table sub-menu.

New table bodies can also be added to a table using the Enter key. When a whole table body is selected (use `F2`), pressing the Enter key creates a new table body after the selected table body.

### Adding something after a table

To go out of the table and add any element after a table you have to select the table element (use `F2`) and press the Enter key. Amaya creates a new paragraph after the selected table. This paragraph can be replaced by another element.