Cdml Table
From: CdmlElements
Description
With this CmdlElement tables in various designs can be created.
Example
This Table
| Country | Inhabitants(Mio) |
Germany | 82.0 |
Austria | 8.0 |
Switzerland | 7.0 |
|
|
is generated from the following input:
[[table]
Country|Inhabitants(Mio)
Germany|82.0
Austria|8.0
Switzerland|7.0
]
- distance: positions the table horizontally (default: centered); e.g. [distance=30]
- width: specifies the width of the entire table and can be given as an absolute value (number of pixels) or as percentage of the browser window (if this parameter is omitted the table gets as much space as is required); e.g. [width=300] or [width=50%]
- titlebackground: specifies the background color of the first row (default: configurable); e.g. [titlebackground=#ccffcc] (see also HtmlColorCodes, CdmlColorNames)
- textbackground: specifies the background color of the remaining rows (default: configurable); e.g. [textbackground=#ffffcc] (see also HtmlColorCodes, CdmlColorNames)
- footerbackground: specifies the background color of the last rows (default: textbackground); e.g. [footerbackground=#ffffcc] (see also HtmlColorCodes, CdmlColorNames)
- linewidth: specifies the width of the border around the table and its cells ; e.g. [linewidth=1]
- linecolor: specifies the color of the border around the table and its cells ; e.g. [linecolor=#000000] (see also HtmlColorCodes, CdmlColorNames)
- align: aligns the text within the cells, possible values are: "l" (left), "c" (center), "r" (right) and "b" (this causes the value of the cell to be displayed as a scaled bar (value * scalefactor = width in pixels; see also parameter scalefactor). (default: left); e.g. [align=lllcrb]:
- padding: sets the amount of space between the cellborder and its content; e.g. [padding=7]
- type: enables additional variations; e.g. [type=invisible] makes the table invisible,which opens up particular text positioning
- scalefactor: scales the length of the bar in cells that are displayed as bars (default: 1); e.g. [scalefactor=5.5] (see also parameter align)
- formatseparator: defines a separator-character to enable individual cell-properties (text-alignment, spanning). This parameter has NO DEFAULT VALUE! e.g. [formatseparator=@]
- Typical Formattings (with @ as formatseparator):
- text@c (text is centered)
- text@l (text is left-aligned)
- text@r (text is right-aligned)
- text@2c ("spans" 2 cells and centers the text)
- text@c#lightyellow (text is centered, backgroundcolor: lightyellow)
- text@#ffffff (backgroundcolor: white)
- Note: The logic of this feature doesn't match HTML-logic, but spreadsheet-logic (spanned cells are defined, but "covered" with the contents of the main cell!
- lineseparator: specifies the line-separator (default: "\n")
- separator: specifies the cell-separator (default: ","); e.g. [separator=//]
- columnwidth: a list of pixel-values to define the width of the individual columns.
More Examples
A table with bars:
| Country | Inhabitants(Mio) | BSP/Inh 1997 | higher ==> |
Germany | 82.0 | 28280 | |
Austria | 8.0 | 27920 | |
Switzerland | 7.0 | 43060 | |
|
|
A table with increased padding:
| Country | Inhabitants(Mio) |
Germany | 82.0 |
Austria | 8.0 |
Switzerland | 7.0 |
|
|
A table with broad borders:
| Country | Inhabitants(Mio) |
Germany | 82.0 |
Austria | 8.0 |
Switzerland | 7.0 |
|
|
A table with centered columns:
| Country | Inhabitants(Mio) |
Germany | 82.0 |
Austria | 8.0 |
Switzerland | 7.0 |
|
|
Combined cells, individual alignment and cell-colors:
| Statistics |
Germany | 82.0 | 13.5 |
Austria | 8.0 | (note the individual alignment of this column) |
Switzerland | 7.0 | 7.3 |
Luxembourg | (no values given) |
Lichtenstein | 1.5 | 1.3 |
|
|
[[table][distance=150][formatseparator=@]
[align=lr][separator=|]
Statistics@3c
Germany|82.0|13.5@c
Austria@#red|8.0@#white|(note the individual alignment of this column)@#red
Switzerland|7.0|7.3@l
Luxembourg|(no values given)@2c
Lichtenstein|1.5|1.3@r
]
An "invisible" table:
| Country | | | Inhabitants (Mio) |
Germany | | | 82.0 |
Austria | | | 8.0 |
Switzerland | | | 7.0 |
|
|
Configuration of Defaults
There are older, individual default value variables for the more important parameters:
| Variable TableTitlebackground: |
#9999ff |
|
|
| Variable TableTextbackground: |
#eeeeee |
|
|
| Variable TableSeparator: |
, |
|
|
but it simpler is to use an combined CdmlElementDefaults option:
| Variable cdml.table.defaults: |
[formatseparator=@] [titlebackground=lightblue] [textbackground=#f8f8f8] [distance=20] [separator=|] |
|
|
which can be given in one line and takes exactly the same syntax and parameter names as in the CdmlTable commands. Also defaults for each parameter can be defined.
FolderWikiFeatures FolderCdml
|