Spans
Cells that span columns (colspan) and rows (rowspan). A spanned-over position holds a placeholder cell (is_placeholder: true).
Each tab is the real output of gridwell convert, and the docs’ tests check that it still is. The Preview is the HTML writer’s output as it renders on this page; the HTML tab shows its markup without the base stylesheet ("base_styles": false), which the Preview has. The ANSI tab is drawn without color ("color": false).
Colspan: a spanner label
A column label row with a label spanning two columns above them.
NoteThe IR:
fixtures/minimal/colspan_basic.json
{
"ir_version": "1.0",
"config": {
"table_cols": 3,
"header_rows": 2,
"body_rows": 2,
"stub_cols": 0,
"row_striping": false,
"row_striping_include_stub": false,
"row_striping_include_body": false,
"column_labels_hidden": false,
"table_width": null,
"container_width": null,
"container_height": null,
"container_overflow": null,
"locale": "en-US",
"page_break_mode": "avoid",
"aria_label": null,
"aria_describedby": null,
"summary": null
},
"styles": {
"defs": {},
"compositions": {},
"conditionals": []
},
"header": {
"title": null,
"subtitle": null,
"extra_lines": [],
"preheader_content": null
},
"column_spec": [
{ "id": "col_0", "align": "left", "align_char": null, "width": "auto", "min_width": null, "max_width": null, "style_id": null, "hidden": false, "label": "Name" },
{ "id": "col_1", "align": "right", "align_char": null, "width": "auto", "min_width": null, "max_width": null, "style_id": null, "hidden": false, "label": "Q1" },
{ "id": "col_2", "align": "right", "align_char": null, "width": "auto", "min_width": null, "max_width": null, "style_id": null, "hidden": false, "label": "Q2" }
],
"table": {
"thead": {
"rows": [
{
"role": "spanner_label",
"style_id": null,
"cells": [
{
"content": [],
"colspan": 1,
"rowspan": 1,
"style_id": null,
"is_stub": false,
"is_placeholder": false,
"scope": null
},
{
"content": [{ "type": "text", "value": "Scores" }],
"colspan": 2,
"rowspan": 1,
"style_id": null,
"is_stub": false,
"is_placeholder": false,
"scope": "colgroup"
},
{
"content": [],
"colspan": 1,
"rowspan": 1,
"style_id": null,
"is_stub": false,
"is_placeholder": true,
"scope": null
}
]
},
{
"role": "column_label",
"style_id": null,
"cells": [
{
"content": [{ "type": "text", "value": "Name" }],
"colspan": 1,
"rowspan": 1,
"style_id": null,
"is_stub": false,
"is_placeholder": false,
"scope": "col"
},
{
"content": [{ "type": "text", "value": "Q1" }],
"colspan": 1,
"rowspan": 1,
"style_id": null,
"is_stub": false,
"is_placeholder": false,
"scope": "col"
},
{
"content": [{ "type": "text", "value": "Q2" }],
"colspan": 1,
"rowspan": 1,
"style_id": null,
"is_stub": false,
"is_placeholder": false,
"scope": "col"
}
]
}
]
},
"tbody": [
{
"group_id": null,
"label": null,
"rows": [
{
"role": null,
"style_id": null,
"cells": [
{
"content": [{ "type": "text", "value": "Alice" }],
"typed_value": { "type": "string", "value": "Alice" },
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": false, "is_placeholder": false
},
{
"content": [{ "type": "text", "value": "90" }],
"typed_value": { "type": "number", "value": 90 },
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": false, "is_placeholder": false
},
{
"content": [{ "type": "text", "value": "95" }],
"typed_value": { "type": "number", "value": 95 },
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": false, "is_placeholder": false
}
]
},
{
"role": null,
"style_id": null,
"cells": [
{
"content": [{ "type": "text", "value": "Bob" }],
"typed_value": { "type": "string", "value": "Bob" },
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": false, "is_placeholder": false
},
{
"content": [{ "type": "text", "value": "85" }],
"typed_value": { "type": "number", "value": 85 },
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": false, "is_placeholder": false
},
{
"content": [{ "type": "text", "value": "88" }],
"typed_value": { "type": "number", "value": 88 },
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": false, "is_placeholder": false
}
]
}
],
"summary_rows": []
}
]
},
"footer": { "footnotes": [], "source_notes": [] },
"extensions": {}
}| Scores | ||
|---|---|---|
| Name | Q1 | Q2 |
| Alice | 90 | 95 |
| Bob | 85 | 88 |
<div class="gw_container">
<style>
.gw_table .gw__al_center { text-align: center }
.gw_table .gw__al_left { text-align: left }
.gw_table .gw__al_right { text-align: right }
</style>
<table class="gw_table">
<thead>
<tr class="gw_spanners">
<th class="gw__al_left"></th>
<th class="gw_spanner gw__al_center" scope="colgroup" colspan="2" id="Scores">Scores</th>
</tr>
<tr class="gw_col_labels">
<th class="gw_col_label gw__al_left" scope="col" id="col_0">Name</th>
<th class="gw_col_label gw__al_right" scope="col" id="col_1">Q1</th>
<th class="gw_col_label gw__al_right" scope="col" id="col_2">Q2</th>
</tr>
</thead>
<tbody>
<tr>
<td headers="col_0">Alice</td>
<td class="gw__al_right" headers="Scores col_1">90</td>
<td class="gw__al_right" headers="Scores col_2">95</td>
</tr>
<tr>
<td headers="col_0">Bob</td>
<td class="gw__al_right" headers="Scores col_1">85</td>
<td class="gw__al_right" headers="Scores col_2">88</td>
</tr>
</tbody>
</table>
</div>\begin{tabular}{lrr}
\toprule
& \multicolumn{2}{c}{Scores} \\
\cmidrule(lr){2-3}
Name & Q1 & Q2 \\
\midrule
Alice & 90 & 95 \\
Bob & 85 & 88 \\
\bottomrule
\end{tabular}#block[
#set align(left)
#table(
columns: (auto, auto, auto,),
align: (left, right, right,),
stroke: none,
table.header(
[],
table.cell(colspan: 2, align: center)[#text(weight: "bold")[Scores]#place(bottom + center, dy: 5pt, line(length: 100%, stroke: 0.5pt))],
[#text(weight: "bold")[Name]],
[#text(weight: "bold")[Q1]],
[#text(weight: "bold")[Q2]],
table.hline(stroke: 0.5pt),
),
[Alice],
[90],
[95],
[Bob],
[85],
[88],
)
]┌────────────┬─────────────────────────┐
│ │ Scores │
│ Name │ Q1 │ Q2 │
├────────────┼────────────┼────────────┤
│ Alice │ 90 │ 95 │
│ Bob │ 85 │ 88 │
└────────────┴────────────┴────────────┘
Rowspan: a cell spanning rows
A body cell spanning two rows.
NoteThe IR:
fixtures/minimal/rowspan_basic.json
{
"ir_version": "1.0",
"config": {
"table_cols": 2,
"header_rows": 1,
"body_rows": 3,
"stub_cols": 1,
"row_striping": false,
"row_striping_include_stub": false,
"row_striping_include_body": false,
"column_labels_hidden": false,
"table_width": null,
"container_width": null,
"container_height": null,
"container_overflow": null,
"locale": "en-US",
"page_break_mode": "avoid",
"aria_label": null,
"aria_describedby": null,
"summary": null
},
"styles": {
"defs": {},
"compositions": {},
"conditionals": []
},
"header": {
"title": null,
"subtitle": null,
"extra_lines": [],
"preheader_content": null
},
"column_spec": [
{ "id": "col_0", "align": "left", "align_char": null, "width": "auto", "min_width": null, "max_width": null, "style_id": null, "hidden": false, "label": "Country" },
{ "id": "col_1", "align": "right", "align_char": null, "width": "auto", "min_width": null, "max_width": null, "style_id": null, "hidden": false, "label": "Value" }
],
"table": {
"thead": {
"rows": [
{
"role": "column_label",
"style_id": null,
"cells": [
{
"content": [{ "type": "text", "value": "Country" }],
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": true, "is_placeholder": false,
"scope": "col"
},
{
"content": [{ "type": "text", "value": "Value" }],
"colspan": 1, "rowspan": 1, "style_id": null,
"is_stub": false, "is_placeholder": false,
"scope": "col"
}
]
}
]
},
"tbody": [
{
"group_id": null,
"label": null,
"rows": [
{
"role": null,
"style_id": null,
"cells": [
{
"content": [{ "type": "text", "value": "Japan" }],
"typed_value": { "type": "string", "value": "Japan" },
"colspan": 1, "rowspan": 2,
"style_id": null, "is_stub": true, "is_placeholder": false
},
{
"content": [{ "type": "text", "value": "100" }],
"typed_value": { "type": "number", "value": 100 },
"colspan": 1, "rowspan": 1,
"style_id": null, "is_stub": false, "is_placeholder": false
}
]
},
{
"role": null,
"style_id": null,
"cells": [
{
"content": [],
"typed_value": null,
"colspan": 1, "rowspan": 1,
"style_id": null, "is_stub": true, "is_placeholder": true
},
{
"content": [{ "type": "text", "value": "110" }],
"typed_value": { "type": "number", "value": 110 },
"colspan": 1, "rowspan": 1,
"style_id": null, "is_stub": false, "is_placeholder": false
}
]
},
{
"role": null,
"style_id": null,
"cells": [
{
"content": [{ "type": "text", "value": "Korea" }],
"typed_value": { "type": "string", "value": "Korea" },
"colspan": 1, "rowspan": 1,
"style_id": null, "is_stub": true, "is_placeholder": false
},
{
"content": [{ "type": "text", "value": "80" }],
"typed_value": { "type": "number", "value": 80 },
"colspan": 1, "rowspan": 1,
"style_id": null, "is_stub": false, "is_placeholder": false
}
]
}
],
"summary_rows": []
}
]
},
"footer": { "footnotes": [], "source_notes": [] },
"extensions": {}
}| Country | Value |
|---|---|
| Japan | 100 |
| 110 | |
| Korea | 80 |
<div class="gw_container">
<style>
.gw_table .gw__al_left { text-align: left }
.gw_table .gw__al_right { text-align: right }
</style>
<table class="gw_table">
<thead>
<tr class="gw_col_labels">
<th class="gw_stubhead gw__al_left" scope="col" id="Country">Country</th>
<th class="gw_col_label gw__al_right" scope="col" id="col_1">Value</th>
</tr>
</thead>
<tbody>
<tr>
<th class="gw_stub gw__al_left" scope="rowgroup" rowspan="2" id="stub-1">Japan</th>
<td class="gw__al_right" headers="stub-1 col_1">100</td>
</tr>
<tr>
<td class="gw__al_right" headers="stub-1 col_1">110</td>
</tr>
<tr>
<th class="gw_stub gw__al_left" scope="row" id="stub-3">Korea</th>
<td class="gw__al_right" headers="stub-3 col_1">80</td>
</tr>
</tbody>
</table>
</div>\begin{tabular}{lr}
\toprule
Country & Value \\
\midrule
\multirow{2}{*}{Japan} & 100 \\
& 110 \\
Korea & 80 \\
\bottomrule
\end{tabular}#block[
#set align(left)
#table(
columns: (auto, auto,),
align: (left, right,),
stroke: none,
table.header(
[#text(weight: "bold")[Country]],
[#text(weight: "bold")[Value]],
table.hline(stroke: 0.5pt),
),
table.cell(rowspan: 2)[Japan],
[100],
[110],
[Korea],
[80],
)
]┌────────────┬────────────┐
│ Country │ Value │
├────────────┼────────────┤
│ Japan │ 100 │
│ │ 110 │
│ Korea │ 80 │
└────────────┴────────────┘