Quote:
Originally Posted by hos
|
Thought I'd try some of those things in that link, and post the results. I've used
hos's first example table, adding an extra line to it:
column 1 | column 2 | column 3 | column 4 | column 5 |
cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
| cell 2 of row 3 | | cell 4 of row 3 | |
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
Merging Cells
Table options, unlike BBCode, are always in lower case. There's one that differs from the others in that it's placed at the start of a cell: '{colsp=2}' (or whatever value) causes that many cells to merge together. The effect only applies on that row and all the following cells are moved up, in this case causing the last one to be lost:
Quote:
[TABLE] column 1 | column 2 | column 3 | column 4 | column 5
{colsp=2}cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2
| cell 2 of row 3 | | cell 4 of row 3
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4[/TABLE]
|
column 1 | column 2 | column 3 | column 4 | column 5 |
cell 1 of row 2 | | cell 3 of row 2 | |
| cell 2 of row 3 | | cell 4 of row 3 | |
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
Column Headings
All the remaining options are added in the TABLE tag itself. The option 'head' gives the first line a distinctive look:
Quote:
[TABLE=head] column 1 | column 2 | column 3...
|
column 1 | column 2 | column 3 | column 4 | column 5 |
---|
cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
| cell 2 of row 3 | | cell 4 of row 3 | |
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
Specifying Table Width
Usually a table is the cumulative width of each column but it can be made to span the posting area by adding the option 'width=100%'. Additional options are added using a semicolon - looks peculiar because the first equals sign starts the list of options, the second one is part of an option:
column 1 | column 2 | column 3 | column 4 | column 5 |
---|
cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
| cell 2 of row 3 | | cell 4 of row 3 | |
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
Smaller percentages can be used, but the table can never be made narrower than is necessary to hold all its contents:
column 1 | column 2 | column 3 | column 4 | column 5 |
---|
cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
| cell 2 of row 3 | | cell 4 of row 3 | |
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
Comes out more like 33%. The width can also be expressed in pixels or em-spaces:
Although percentages greater than 100% won't make the table wider than the posting area, larger tables can be achieved by increasing the width of the posting area itself, for example with a long line of dashes.
Auto-numbering
The 'autonum=1' option inserts a column at the front of the table and automatically fills it with sequential numbers:
| column 1 | column 2 | column 3 | column 4 | column 5 |
---|
1 | cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
2 | | cell 2 of row 3 | | cell 4 of row 3 | |
3 | cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
The numbers go up to 500, which is the maximum number of rows possible. Lower-case letters can be used instead:
Quote:
[TABLE=head;autonum=a (or just autonum)]
|
Letters run from a-z, then aa-sf. Uppercase letters can also be specified:
The numbering begins on the second row because the 'head' option was used. The first cell of all is left blank, but the 'autonumtitle' option can specify a heading:
Quote:
[TABLE=head;autonum=1;autonumtitle=count]
|
count | column 1 | column 2 | column 3 | column 4 | column 5 |
---|
1 | cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
2 | | cell 2 of row 3 | | cell 4 of row 3 | |
3 | cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
Sorting
The 'sort' option sorts the table by the specified column. The 'head' option once again prevents the first row being affected:
column 1 | column 2 | column 3 | column 4 | column 5 |
---|
| cell 2 of row 3 | | cell 4 of row 3 | |
cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
The sort order can be reversed with the addition of 'd' for descending:
column 1 | column 2 | column 3 | column 4 | column 5 |
---|
cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
| cell 2 of row 3 | | cell 4 of row 3 | |
If 'autonum' is also used, the sort ignores it, so column 1 is still column 1 and the auto-numbers are applied afterwards rather than being sorted:
Quote:
[TABLE=head;sort=1d;autonum=1]
|
| column 1 | column 2 | column 3 | column 4 | column 5 |
---|
1 | cell 1 of row 4 | | cell 3 of row 4 | | cell 5 of row 4 |
2 | cell 1 of row 2 | | cell 3 of row 2 | | cell 5 of row 2 |
3 | | cell 2 of row 3 | | cell 4 of row 3 | |
Finally, secondary sort orders can be defined by specifying further column numbers, separated by commas: