Skip to end of metadata
Go to start of metadata

Description

The Table macro and its related macros allow the creation of custom table layouts in Confluence content. While tables can easily be created using standard Confluence tools, they are somewhat inflexible - for example, you can't make a cell span multiple rows or columns and you can't add your own styling to them.

This group of macros overcome these restrictions.

Confluence v5.9 onwards requires Content Formatting for Confluence v4.4 or higher for some macros to function properly. In the case of Content Formatting tables there are some restrictions imposed by Atlassian. These restrictions limit which macros can be used inside Content Formatting tables. If upgrading to Confluence version 5.9 or higher it is recommended that pages which use Content Formatting tables are analysed and manually modified if required. An HTML Table macro can only contain a Table Row (tr) macro or a Table Body (tbody) macro. A Table Row macro can only contain a Table Cell (td) macro. If other macros are added to the HTML Table, Table Row or Table Body will result in the table not rendering properly.

Usage

Click Insert > Other Macros.


Select the HTML Table macro from the provided list.


Fields common to Table related macros.

ParameterDescriptionType

Default

Required?
SummaryA summary of the table's contents to facilitate non-visual browsing. stringnone(error)
ID A unique id for the element.

string

none(error)
CSS ClassSpecify the class of the element.stringnone(error)
Inline StyleAn inline style definition.stringnone(error)
TitleText to display in a tooltip.stringnone(error)
Text DirectionSets the text direction.single selectnone(error)
Language CodeSets the language code.stringnone(error)


The macro will then appear on the page.


Inside the body of the HTML Table macro add the Table Row macro.


Complete the desired fields.

ParameterDescriptionType

Default

Required?
Align CharacterSpecifies which character to align text on.stringnone

(error)

Align Character OffsetSpecifies the alignment offset to the first character to align on.stringnone

(error)


The macro will then appear on the page.


Inside the body of the Table Row macro add the Table Cell macro.


Complete the desired fields.

ParameterDescriptionType

Default

Required?
Align CharacterSpecifies which character to align text on.stringnone

(error)

Align Character OffsetSpecifies the alignment offset to the first character to align on.stringnone

(error)

Column spanIndicates the number of columns this cell should span.stringnone

(error)

HeadersA space-separated list of cell IDs that supply header information for the cell. This attribute allows text-only browsers to render the header information for a given cell.stringnone

(error)

HeightSpecifies the height of the table cell.intnone

(error)

Row SpanIndicates the number of rows this cell should span.int1

(error)

ScopeSpecifies if this cell provides header information for the rest of the row that contains it (row), or for the rest of the column (col), or for the rest of the row group that contains it (rowgroup), or for the rest of the column group that contains it.stringnone

(error)


The macro will then appear on the page.

Add Table Row and Table Cell macros to build up a table. Table Cell macros should be inside Table Row macros, and Table Row macros should be inside a HTML Table macro.


There's not much use in creating such a simple table - in the examples later on this page we have more comprehensive uses for these macros.


Examples:

Basic Table

Create a basic table as follows:


Resulting in:

Cell 1 Cell 2


Sortable Table

To create a sortable table use the Table Head \{th} macros. A table heading is part of a properly formatted table that will display as bold with a grey backgound on Confluence pages.

The structure should be similar to this example, which also uses the Table Heading and Table Body macros to define those areas of the table.

With Class parameter set to "aui".


HTML Output

<table class="aui tablesorter tablesorter-default">
    <thead>
        <tr class="tablesorter-headerRow">
            <th class="sortableHeader" data-column="0" style="-moz-user-select: none;" tabindex="0"
                unselectable="on">
                <div class="tablesorter-header-inner">
                    <p>One</p>
                </div>
            </th>
            <th class="sortableHeader" data-column="1" style="-moz-user-select: none;" tabindex="0"
                unselectable="on">
                <div class="tablesorter-header-inner">
                    <p>Two</p>
                </div>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>
                <p>abc</p>
            </td>
            <td>
                <p>xyz</p>
            </td>
        </tr>
        <tr>
            <td>
                <p>zyx</p>
            </td>
            <td>
                <p>cba</p>
            </td>
        </tr>
    </tbody>
</table>


Resulting in:

One

Two

abc

xyz

zyx

cba



  • No labels