SourceForge.net Logo
January 25, 2011
GPL
ProWikiCenter
Cdml Table

From: CdmlElements

Description

With this CmdlElement tables in various designs can be created.


Example

This Table

CountryInhabitants(Mio)
Germany82.0
Austria8.0
Switzerland7.0

is generated from the following input:

[[table]
Country|Inhabitants(Mio)
Germany|82.0
Austria|8.0
Switzerland|7.0
]


Parameters

  • 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:

CountryInhabitants(Mio)BSP/Inh 1997higher ==>
Germany82.028280
Austria8.027920
Switzerland7.043060


A table with increased padding:

CountryInhabitants(Mio)
Germany82.0
Austria8.0
Switzerland7.0


A table with broad borders:

CountryInhabitants(Mio)
Germany82.0
Austria8.0
Switzerland7.0


A table with centered columns:

CountryInhabitants(Mio)
Germany82.0
Austria8.0
Switzerland7.0


Combined cells, individual alignment and cell-colors:

Statistics
Germany82.013.5
Austria8.0(note the individual alignment of this column)
Switzerland7.07.3
Luxembourg(no values given)
Lichtenstein1.51.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 TableDistance:

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