Home/Confluence storage format reference
Confluence storage format
Merged table cells in Confluence storage format
Merged cells use the standard rowspan and colspan attributes on td or th. The storage format page documents rowspan with a two-row example. In ADF every cell carries both span values, and the converter writes only the ones that differ from 1.
Storage format
<td rowspan="2">Merged Cell</td>
<td colspan="2">Wide cell</td>
As ADF (Confluence Cloud)
The ADF that Confluence Cloud builds for:
<table><tbody><tr><th>Table Heading Cell 1</th><th>Table Heading Cell 2</th></tr><tr><td rowspan="2">Merged Cell</td><td>Normal Cell 1</td></tr><tr><td colspan="1">Normal Cell 2</td></tr></tbody></table>
{
"type": "doc",
"content": [
{
"type": "table",
"attrs": {
"__autoSize": true
},
"content": [
{
"type": "tableRow",
"content": [
{
"type": "tableHeader",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Table Heading Cell 1",
"type": "text"
}
]
}
]
},
{
"type": "tableHeader",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Table Heading Cell 2",
"type": "text"
}
]
}
]
}
]
},
{
"type": "tableRow",
"content": [
{
"type": "tableCell",
"attrs": {
"colspan": 1,
"rowspan": 2
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Merged Cell",
"type": "text"
}
]
}
]
},
{
"type": "tableCell",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Normal Cell 1",
"type": "text"
}
]
}
]
}
]
},
{
"type": "tableRow",
"content": [
{
"type": "tableCell",
"attrs": {
"colspan": 1,
"rowspan": 1
},
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Normal Cell 2",
"type": "text"
}
]
}
]
}
]
}
]
}
],
"version": 1
}
Examples
Storage format sent
<table><tbody><tr><th>Table Heading Cell 1</th><th>Table Heading Cell 2</th></tr><tr><td rowspan="2">Merged Cell</td><td>Normal Cell 1</td></tr><tr><td colspan="1">Normal Cell 2</td></tr></tbody></table>The merged-cell example from the storage format page: one cell spanning two rows, plus a cell that states colspan="1" explicitly.
Rendered view (HTML)
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th class="confluenceTh">Table Heading Cell 1</th><th class="confluenceTh">Table Heading Cell 2</th></tr><tr><td rowspan="2" class="confluenceTd">Merged Cell</td><td class="confluenceTd">Normal Cell 1</td></tr><tr><td colspan="1" class="confluenceTd">Normal Cell 2</td></tr></tbody></table></div>Storage format after the round trip through ADF
<table data-layout="default"><tbody><tr><th><p>Table Heading Cell 1</p></th><th><p>Table Heading Cell 2</p></th></tr><tr><td rowspan="2"><p>Merged Cell</p></td><td><p>Normal Cell 1</p></td></tr><tr><td><p>Normal Cell 2</p></td></tr></tbody></table>Sent to Confluence Cloud on .
Storage format sent
ADF:{"content": [{"attrs": {"isNumberColumnEnabled": true, "layout": "wide"}, "content": [{"content": [{"content": [{"content": [{"text": "H1", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}, {"content": [{"content": [{"text": "H2", "type": "text"}], "type": "paragraph"}], "type": "tableHeader"}], "type": "tableRow"}, {"content": [{"attrs": {"colspan": 2}, "content": [{"content": [{"text": "merged", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}, {"content": [{"attrs": {"background": "#deebff"}, "content": [{"content": [{"text": "bg", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}, {"content": [{"content": [{"text": "x", "type": "text"}], "type": "paragraph"}], "type": "tableCell"}], "type": "tableRow"}], "type": "table"}], "type": "doc", "version": 1}A cell that spans two columns, created from ADF with colspan 2. Shows what Confluence writes when the editor, not a person, produces the span.
Rendered view (HTML)
<div class="table-wrap"><table data-layout="wide" class="confluenceTable"><colgroup><col/></colgroup><tbody><tr><th class="numberingColumn confluenceTh" /><th class="confluenceTh"><p>H1</p></th><th class="confluenceTh"><p>H2</p></th></tr><tr><td class="numberingColumn confluenceTd">1</td><td colspan="2" class="confluenceTd"><p>merged</p></td></tr><tr><td class="numberingColumn confluenceTd">2</td><td data-highlight-colour="#deebff" class="confluenceTd"><p>bg</p></td><td class="confluenceTd"><p>x</p></td></tr></tbody></table></div>Storage format after the round trip through ADF
<table data-layout="wide"><colgroup><col /></colgroup><tbody><tr><th class="numberingColumn" /><th><p>H1</p></th><th><p>H2</p></th></tr><tr><td class="numberingColumn">1</td><td colspan="2"><p>merged</p></td></tr><tr><td class="numberingColumn">2</td><td data-highlight-colour="#deebff"><p>bg</p></td><td><p>x</p></td></tr></tbody></table>Sent to Confluence Cloud on .
Storage format sent
<table><tbody><tr><th>Table Heading Cell 1</th><th>Table Heading Cell 2</th></tr><tr><td>Normal Cell 1</td><td>Normal Cell 2</td></tr></tbody></table>A table with no spans at all. After conversion no rowspan or colspan attribute appears, although every ADF cell carries both values.
Rendered view (HTML)
<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th class="confluenceTh">Table Heading Cell 1</th><th class="confluenceTh">Table Heading Cell 2</th></tr><tr><td class="confluenceTd">Normal Cell 1</td><td class="confluenceTd">Normal Cell 2</td></tr></tbody></table></div>Storage format after the round trip through ADF
<table data-layout="default"><tbody><tr><th><p>Table Heading Cell 1</p></th><th><p>Table Heading Cell 2</p></th></tr><tr><td><p>Normal Cell 1</p></td><td><p>Normal Cell 2</p></td></tr></tbody></table>Sent to Confluence Cloud on .
What changes in conversion
- rowspan="2" is kept in both directions and the rendered table spans two rows.
- An explicit colspan="1" is accepted in storage and rendered, but it is gone after the ADF round trip, because the default value is not written back.
- colspan="2" written as storage was saved and read back unchanged, and a span created from ADF comes back as colspan="2" on the td.
- ADF stores colspan and rowspan on every tableCell and tableHeader as numbers, and the converter writes a span to storage only when it is larger than 1.
Pitfalls
- Do not count on colspan="1" or rowspan="1" staying in the stored text. They are removed when the editor saves.
- A span created from ADF has to be read back from storage, not from the ADF you sent: the storage text only carries spans larger than 1.
- The runs only merged td cells. A span on a header cell in ADF carries the same two numbers, but no storage run covers it.
Related
- Tables
- Cell background colours
- Table width, layout and numbered rows
- Lists, paragraphs and tables in cells