Template:Table/documentation: Difference between revisions
Kate Racaza (talk | contribs) No edit summary |
Kate Racaza (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
={{Font|Template Documentation|16|Calibri|bold|black}}= | ={{Font|Template Documentation|16|Calibri|bold|black}}= | ||
This template contains table formats that can be applied to any existing table in ReliaWiki. It does not automatically create a table for you; rather it ensures that any table | This template contains table formats that can be applied to any existing table in ReliaWiki. It does not automatically create a table for you; rather it ensures that any table where the template is transcluded into will have consistent looking borders, cell padding, header shading and text alignment. (If you don't know how to create a table, see the Notes section below.) | ||
Here is an example of what a generic table looks like when you use this template. | Here is an example of what a generic table looks like when you use this template. | ||
{| {{Table}} | {| {{Table|35}} | ||
! Column 1 | ! Column 1 | ||
! Column 2 | ! Column 2 | ||
Line 18: | Line 18: | ||
| Row 3||789 | | Row 3||789 | ||
|} | |} | ||
==Usage== | ==Usage== | ||
To use this template, type the code '''<nowiki>{{table}}</nowiki>''' next to the table's opening brackets. For example, below is the code for the example table shown above. | To use this template, type the code '''<nowiki>{{table|XX}}</nowiki>''' next to the table's opening brackets, where '''XX''' is the desired table width. If you do not specify a table width, the table will auto-adjust to fit the contents of the table (this may look just right or too crowded, depending on the contents of the table). For example, below is the code for the example table shown above. | ||
<pre>{| {{table}} | <pre>{| {{table|35}} | ||
! Column 1 | ! Column 1 | ||
! Column 2 | ! Column 2 | ||
Line 34: | Line 33: | ||
|}</pre> | |}</pre> | ||
== | '''Custom Designs''' | ||
Below are some examples of styles you could add to a table. To learn more about manually formatting tables using wiki code, see the tutorial at http://www.mediawiki.org/wiki/Help:Tables. | |||
{|{{table}} | |||
!You Type | |||
!You Get | |||
|- | |||
|style="text-align:left;"|Merge rows and columns | |||
<pre> | |||
{| {{table}} | |||
!colspan="2"| Column 1 | |||
|- | |||
| Row 1||123 | |||
|- | |||
|rowspan="2"|Row 2||456 | |||
|- | |||
|789 | |||
|}</pre> | |||
|| | |||
{| {{table}} | |||
!colspan="2"| Column 1 | |||
|- | |||
| Row 1||123 | |||
|- | |||
|rowspan="2"|Row 2||456 | |||
|- | |||
|789 | |||
|} | |||
|- | |||
|style="text-align:left;"|Change text justification | |||
<pre> | |||
{| {{table}} | |||
!Column 1 | |||
!Column 2 | |||
|-style="text-align:left;" | |||
|Row 1||123 | |||
|-style="text-align:right;" | |||
|Row 2||456 | |||
|- | |||
|Row 3 ||789 | |||
|}</pre> | |||
|| | |||
{| {{table}} | |||
!Column 1 | |||
!Column 2 | |||
|-style="text-align:left;" | |||
|Row 1||123 | |||
|-style="text-align:right;" | |||
|Row 2||456 | |||
|- | |||
|Row 3 ||789 | |||
|} | |||
|- | |||
|style="text-align:left;"|Change column widths | |||
<pre> | |||
{| {{table}} | |||
!Column 1 | |||
!Column 2 | |||
|- | |||
|Row 1||style="width: 80%;"|123 | |||
|- | |||
|Row 2||456 | |||
|- | |||
|Row 3 ||789 | |||
|}</pre> | |||
|| | |||
{| {{table}} | |||
!Column 1 | |||
!Column 2 | |||
|- | |||
|Row 1||style="width: 80%;"|123 | |||
|- | |||
|Row 2||456 | |||
|- | |||
|Row 3 ||789 | |||
|} | |||
|} | |||
==Notes== | |||
You can automatically convert an Excel table into the appropriate wiki code by using the free tool at http://excel2wiki.net/index.php. To ensure that the output you get from the tool works with this template, you must remove the formatting that the tool automatically assigns to the table headers. For instance, if you copy and paste our example table into the tool, the output will be: | |||
<pre>{| {{table}} | <pre>{| {{table}} | ||
Line 53: | Line 129: | ||
In this case, you must delete the formatting around "Column 1" and "Column 2" and replace them with exclamation marks (!). See the code shown in the Usage section to see what this looks like. In a table, an exclamation mark indicates a table header. Table headers appear in bold and are centered by default. | In this case, you must delete the formatting around "Column 1" and "Column 2" and replace them with exclamation marks (!). See the code shown in the Usage section to see what this looks like. In a table, an exclamation mark indicates a table header. Table headers appear in bold and are centered by default. | ||
</div> | </div> |
Revision as of 18:54, 10 June 2014
Template Documentation
This template contains table formats that can be applied to any existing table in ReliaWiki. It does not automatically create a table for you; rather it ensures that any table where the template is transcluded into will have consistent looking borders, cell padding, header shading and text alignment. (If you don't know how to create a table, see the Notes section below.)
Here is an example of what a generic table looks like when you use this template.
Column 1 | Column 2 |
---|---|
Row 1 | 123 |
Row 2 | 456 |
Row 3 | 789 |
Usage
To use this template, type the code {{table|XX}} next to the table's opening brackets, where XX is the desired table width. If you do not specify a table width, the table will auto-adjust to fit the contents of the table (this may look just right or too crowded, depending on the contents of the table). For example, below is the code for the example table shown above.
{| {{table|35}} ! Column 1 ! Column 2 |- | Row 1||123 |- | Row 2||456 |- | Row 3||789 |}
Custom Designs
Below are some examples of styles you could add to a table. To learn more about manually formatting tables using wiki code, see the tutorial at http://www.mediawiki.org/wiki/Help:Tables.
You Type | You Get | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merge rows and columns
{| {{table}} !colspan="2"| Column 1 |- | Row 1||123 |- |rowspan="2"|Row 2||456 |- |789 |} |
| ||||||||
Change text justification
{| {{table}} !Column 1 !Column 2 |-style="text-align:left;" |Row 1||123 |-style="text-align:right;" |Row 2||456 |- |Row 3 ||789 |} |
| ||||||||
Change column widths
{| {{table}} !Column 1 !Column 2 |- |Row 1||style="width: 80%;"|123 |- |Row 2||456 |- |Row 3 ||789 |} |
|
Notes
You can automatically convert an Excel table into the appropriate wiki code by using the free tool at http://excel2wiki.net/index.php. To ensure that the output you get from the tool works with this template, you must remove the formatting that the tool automatically assigns to the table headers. For instance, if you copy and paste our example table into the tool, the output will be:
{| {{table}} | align="center" style="background:#f0f0f0;"|'''Column 1''' | align="center" style="background:#f0f0f0;"|'''Column 2''' |- | Row 1||123 |- | Row 2||456 |- | Row 3||789 |}
In this case, you must delete the formatting around "Column 1" and "Column 2" and replace them with exclamation marks (!). See the code shown in the Usage section to see what this looks like. In a table, an exclamation mark indicates a table header. Table headers appear in bold and are centered by default.