version=pmwiki-2.1.14 ordered=1 urlencoded=1
agent=Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.0.6) Gecko/20060728 SUSE/1.5.0.6-1.3 Firefox/1.5.0.6
author=Pm
csum=fix audience case
ctime=1141945978
host=24.1.26.255
name=PmWiki.Tables
rev=17
targets=PmWiki.TableDirectives,PmWiki.DocumentationIndex,PmWiki.Tables
text=%25audience%25 authors (basic)%0a%0a!! Table basics%0a%0aPmWiki has two types of table markup; the markup described in this page is useful for creating tables with lots of small cells, while [[table directive(s)]] markups help with larger scale tables.  For more possibilities with table formatting see [[Cookbook:FormattingTables]].%0a%0aTables are created via use of the double pipe character: @@||@@. Lines beginning with this markup denote rows in a table; within such lines the double-pipe is used to delimit cells.  In the examples below a border is added for illustration (the default is no border).%0a%0a(:markup caption='Basic table':) [=%0a|| border=1%0a|| cell 1 || cell 2 || cell 3 ||%0a|| cell 1 || cell 2 || cell 3 ||=]%0a%0aHeader cells can be created by placing ! as the first character of a cell.  Note that these are ''table headers'', not ''headings'', so it doesn't extend to !!, !!!, etc.%0a%0a(:markup caption='Table headers':) [=%0a|| border=1%0a||! cell 1 ||! cell 2 ||! cell 3 ||%0a|| cell 1  ||  cell 2 ||  cell 3 ||=]%0a%0aA table can have a caption, indicated by [@||!caption!||@].  Any caption must appear prior to other rows of the table.%0a%0a(:markup caption='Table caption':) [=%0a|| border=1%0a||! A special table !||%0a||! cell 1 ||! cell 2 ||! cell 3 ||%0a|| cell 1  ||  cell 2 ||  cell 3 ||=]%0a%0a%0a!! Formatting cell contents%0a%0aCell contents may be aligned left, centered, or aligned right. %0a* To left-align contents, place the cell contents next to the leading @@||@@.%0a* To center contents, add a space before and after the cell contents.%0a* To right-align contents, place a space before the cell contents and leave the cell contents next to the trailing @@||@@.%0a%0a(:markup caption='Cell alignments':) [=%0a|| border=1 width=100%25%0a||!cell 1      ||! cell 2  ||!       cell 3||%0a||left-aligned || centered || right-aligned||=]%0a%0a(:markup caption='Default cell alignments':) [=%0a|| border=1 width=100%25%0a||!cell default||!cell left ||%0a||default-aligned||left-aligned ||=]%0a%0aNote that header and detail cells have different default alignments.%0a%0aTo get a cell to span multiple columns, follow the cell with empty cells.%0a(At present there is no markup for spanning rows.)%0a%0a(:markup caption='Column spanning':) [=%0a|| border=1 width=100%25%0a|| |||| right column ||%0a|| || middle column ||||%0a|| left column ||||||%0a|| left column || middle column || right column ||%0a=]%0a%0a!! Table attributes%0a%0aAny line that begins with [@||@] but doesn't have a closing [@||@] sets the ''table attributes'' for any tables that follow.  These attributes can control the size and position of the table, borders, background color, and cell spacing.  (In fact these are just standard HTML attributes that are placed in the %3ctable> tag.)%0a%0aUse the [@width=@] attribute to set a table's width, using either a percentage value or an absolute size.%0a%0a(:markup caption='Table width':) [=%0a|| border=1 width=100%25 %0a|| cell 1 || cell 2 || cell 3 ||%0a|| c1 || cellcellcellcell2 || cell 3 ||=]%0a%0aThe [@border=@] attribute sets the size of a table's borders.%0a%0a(:markup caption='Bordered and borderless tables':) [=%0a|| border=10 %0a||!cell 1      ||! cell 2  ||!       cell 3||%0a||left-aligned || centered || right-aligned||%0a%0a|| border=0%0a||!cell 1      ||! cell 2  ||!       cell 3||%0a||left-aligned || centered || right-aligned||=]%0a%0aUse [@align=center@], [@align=left@], and [@align=right@] to center, left, or right align a table.  Note that [@align=left@] and [@align=right@] create a ''floating table'', such that text wraps around the table.%0a%0a(:markup caption='Table alignment':) [=%0a|| border=1 align=center%0a||!cell 1      ||! cell 2  ||!       cell 3||%0a||left-aligned || centered || right-aligned||%0a%0a|| border=1 align=left%0a||!cell 1      ||! cell 2  ||!       cell 3||%0a||left-aligned || centered || right-aligned||%0aNotice how text wraps to the right of a table using "align=left".=]%0a%0aThe [@bgcolor=@] attribute sets the background color for a table.  At present there is no way to specify the color of individual rows or cells in this type of table (but see Cookbook:FormattingTables).%0a%0a(:markup:) [=%0a|| border=1 align=center bgcolor=yellow%0a||!cell 1      ||! cell 2  ||!       cell 3||%0a||left-aligned || centered || right-aligned||=]%0a%0a!!Other examples%0a%0a(:markup caption='A more complex table':) [=%0a%25define=sp padding-right:1em font-weight:bold%25%0a|| border=1%0a|| [++Events Calendar++] ||||||||||%0a|| '''May 2005''' || '''June 2005''' || '''July 2005''' || '''August 2005''' || '''September 2005''' ||%0a||%25sp%25'''10'''%25%256:30 - 8:30 Big Meeting\\\%0a%25sp%25'''17'''%25%257:00 - 8:30 Bigger Meeting\\\%0a%25sp%25'''24'''%25%257:00 - 8:30 Biggest Meeting|| || || || ||%0a|| '''October 2005''' || '''November 2005''' || '''December 2005''' || '''January 2006''' || '''February 2006''' ||%0a|| || || || || ||%0a=]%0a%0a%25trail%25%3c%3c|[[Documentation Index]]|>>%0a%0a>>faq%3c%3c [[#faq]]%0a%0aQ: How do I create nice tables similar to Product X?  %0aA: See [[tables]] and [[table directives]].%0a
time=1156527570
