tutoriales-base:tutoriales:tablas

¡Esta es una revisión vieja del documento!


Tablas

La wiki soporta la construcción de tablas con diferentes alineamientos una sintaxis muy sencilla.

Los encabezados deben iniciarse, separarse y finalizarse por el símbolo “^” y las filas por barras verticales “|”.

Así, una tabla sencilla seria:

^ Encabezado 1     ^ Encabezado 2     ^ Encabezado 3     ^
| Fila 1 Columna 1 | Fila 1 Columna 2 | Fila 1 Columna 3 |
| Fila 2 Columna 1 | Fila 2 Columna 2 | Fila 2 Columna 3 |
| Fila 3 Columna 1 | Fila 3 Columna 2 | Fila 3 Columna 3 |

Que dará la siguiente salida:

Encabezado 1 Encabezado 2 Encabezado 3
Fila 1 Columna 1 Fila 1 Columna 2 Fila 1 Columna 3
Fila 2 Columna 1 Fila 2 Columna 2 Fila 2 Columna 3
Fila 3 Columna 1 Fila 3 Columna 2 Fila 3 Columna 3

Para conectar horizontalmente celdas, solo debe dejar en blanco la celda de la derecha.

Tenga en cuenta que la cantidad de separadores “|” debe ser la misma que en el caso normal.

El siguiente código ilustra el caso:

^ Encabezado 1     ^ Encabezado 2     ^ Encabezado 3     ^
| Fila 1 Columna 1 | Fila 1 Columna 2 | Fila 1 Columna 3 |
| Fila 2 Columna 1 | Fila 2 Columna 2 y 3 Texto muy muy muy  muy muy muy muy muy muy muy muy muy muy muy muy muy muy muy Largo              ||
| Fila 3 Columna 1 | Fila 3 Columna 2 | Fila 3 Columna 3 |

La salida sera:

Encabezado 1 Encabezado 2 Encabezado 3
Fila 1 Columna 1 Fila 1 Columna 2 Fila 1 Columna 3
Fila 2 Columna 1 Fila 2 Columna 2 y 3
Fila 3 Columna 1 Fila 3 Columna 2 Fila 3 Columna 3

Vertical tableheaders are possible, too.

Heading 1 Heading 2
Heading 3 Row 1 Col 2 Row 1 Col 3
Heading 4 no colspan this time
Heading 5 Row 2 Col 2 Row 2 Col 3

As you can see, it's the cell separator before a cell which decides about the formatting:

|              ^ Heading 1            ^ Heading 2          ^
^ Heading 3    | Row 1 Col 2          | Row 1 Col 3        |
^ Heading 4    | no colspan this time |                    |
^ Heading 5    | Row 2 Col 2          | Row 2 Col 3        |

You can have rowspans (vertically connected cells) by adding ::: into the cells below the one to which they should connect.

Heading 1 Heading 2 Heading 3
Row 1 Col 1 this cell spans vertically Row 1 Col 3
Row 2 Col 1 Row 2 Col 3
Row 3 Col 1 Row 2 Col 3

Apart from the rowspan syntax those cells should not contain anything else.

^ Heading 1      ^ Heading 2                  ^ Heading 3          ^
| Row 1 Col 1    | this cell spans vertically | Row 1 Col 3        |
| Row 2 Col 1    | :::                        | Row 2 Col 3        |
| Row 3 Col 1    | :::                        | Row 2 Col 3        |

You can align the table contents, too. Just add at least two whitespaces at the opposite end of your text: Add two spaces on the left to align right, two spaces on the right to align left and two spaces at least at both ends for centered text.

Table with alignment
right center left
left right center
xxxxxxxxxxxx xxxxxxxxxxxx xxxxxxxxxxxx

This is how it looks in the source:

^           Table with alignment           ^^^
|         right|    center    |left          |
|left          |         right|    center    |
| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |

Note: Vertical alignment is not supported.

  • tutoriales-base/tutoriales/tablas.1730050320.txt.gz
  • Última modificación: 2024/10/27 14:32
  • por upadmin