Content Formatting Macros for Confluence Server and DC

Table Layouts

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, a cell cannot span multiple rows or columns and custom styling cannot be added to the cells.

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

  1. Go to the form you wish to edit.

  2. Click Edit.

  3. Click Insert More Content, and select Other Macros.

  4. Select the HTML Table macro from the provided list.

    table 01
  5. Fields common to Table related macros:

    Parameter Description Type Default Required

    Summary

    A summary of the table’s contents to facilitate non-visual browsing

    string

    none

    error

    ID

    A unique id for the element

    string

    none

    error

    CSS Class

    Specify the class of the element

    string

    none

    error

    Inline Style

    An inline style definition

    string

    none

    error

    Title

    Text to display in a tooltip

    string

    none

    error

    Text Direction

    Sets the text direction

    single select

    none

    error

    Language Code

    Sets the language code

    string

    none

    error
  6. The macro will then appear on the page.

    table 02
  7. Inside the body of the HTML Table macro add the Table Row macro.

    table 03
  8. Complete the desired fields.

    Parameter Description Type Default Required

    Align Character

    Specifies which character to align text on

    string

    none

    error

    Align Character Offset

    Specifies the alignment offset to the first character to align on

    string

    none

    error
  9. The macro will then appear on the page.

    table 04
  10. Inside the body of the Table Row macro, add the Table Cell macro.

  11. Complete the desired fields.

    Parameter Description Type Default Required

    Align Character

    Specifies which character to align text on.

    string

    none

    error

    Align Character Offset

    Specifies the alignment offset to the first character to align on.

    string

    none

    error

    Column span

    Indicates the number of columns this cell should span.

    string

    none

    error

    Headers

    A 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.

    string

    none

    error

    Height

    Specifies the height of the table cell.

    int

    none

    error

    Row Span

    Indicates the number of rows this cell should span.

    int

    1

    error

    Scope

    Specifies 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.

    string

    none

    error
  12. The macro will then appear on the page.

    table 05

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:

table 06

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 background 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":
table 07

HTML Output

table 08

Resulting in:

One

Two

abc

xyz

zyx

cba