Grouped Table
A table whose body is in two row groups, each with a label, and whose first column is the stub.
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).
NoteThe IR:
fixtures/minimal/row_group_multiple.json
{
"ir_version": "1.0",
"config": {
"table_cols": 3,
"header_rows": 1,
"body_rows": 4,
"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": "City" },
{ "id": "col_1", "align": "right", "align_char": null, "width": "auto", "min_width": null, "max_width": null, "style_id": null, "hidden": false, "label": "Pop" },
{ "id": "col_2", "align": "right", "align_char": null, "width": "auto", "min_width": null, "max_width": null, "style_id": null, "hidden": false, "label": "Area" }
],
"table": {
"thead": {
"rows": [
{
"role": "column_label",
"style_id": null,
"cells": [
{ "content": [{ "type": "text", "value": "City" }], "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": true, "is_placeholder": false, "scope": "col" },
{ "content": [{ "type": "text", "value": "Pop (M)" }], "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false, "scope": "col" },
{ "content": [{ "type": "text", "value": "Area (km\u00b2)" }], "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false, "scope": "col" }
]
}
]
},
"tbody": [
{
"group_id": "grp_asia",
"label": {
"content": [{ "type": "text", "value": "Asia" }],
"style_id": null,
"colspan": null
},
"rows": [
{
"role": null, "style_id": null,
"cells": [
{ "content": [{ "type": "text", "value": "Tokyo" }], "typed_value": { "type": "string", "value": "Tokyo" }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": true, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "13.96" }], "typed_value": { "type": "number", "value": 13.96 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "2,194" }], "typed_value": { "type": "number", "value": 2194 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false }
]
},
{
"role": null, "style_id": null,
"cells": [
{ "content": [{ "type": "text", "value": "Seoul" }], "typed_value": { "type": "string", "value": "Seoul" }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": true, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "9.74" }], "typed_value": { "type": "number", "value": 9.74 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "605" }], "typed_value": { "type": "number", "value": 605 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false }
]
}
],
"summary_rows": []
},
{
"group_id": "grp_europe",
"label": {
"content": [{ "type": "text", "value": "Europe" }],
"style_id": null,
"colspan": null
},
"rows": [
{
"role": null, "style_id": null,
"cells": [
{ "content": [{ "type": "text", "value": "London" }], "typed_value": { "type": "string", "value": "London" }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": true, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "8.98" }], "typed_value": { "type": "number", "value": 8.98 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "1,572" }], "typed_value": { "type": "number", "value": 1572 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false }
]
},
{
"role": null, "style_id": null,
"cells": [
{ "content": [{ "type": "text", "value": "Paris" }], "typed_value": { "type": "string", "value": "Paris" }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": true, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "2.16" }], "typed_value": { "type": "number", "value": 2.16 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false },
{ "content": [{ "type": "text", "value": "105" }], "typed_value": { "type": "number", "value": 105 }, "colspan": 1, "rowspan": 1, "style_id": null, "is_stub": false, "is_placeholder": false }
]
}
],
"summary_rows": []
}
]
},
"footer": { "footnotes": [], "source_notes": [] },
"extensions": {}
}| City | Pop (M) | Area (km²) |
|---|---|---|
| Asia | ||
| Tokyo | 13.96 | 2,194 |
| Seoul | 9.74 | 605 |
| Europe | ||
| London | 8.98 | 1,572 |
| Paris | 2.16 | 105 |
<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="City">City</th>
<th class="gw_col_label gw__al_right" scope="col" id="col_1">Pop (M)</th>
<th class="gw_col_label gw__al_right" scope="col" id="col_2">Area (km²)</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="3" scope="colgroup" class="gw_group_label gw__al_left" id="grp_asia">
Asia
</th>
</tr>
<tr>
<th class="gw_stub gw__al_left" scope="row" id="stub-1">Tokyo</th>
<td class="gw__al_right" headers="grp_asia stub-1 col_1">13.96</td>
<td class="gw__al_right" headers="grp_asia stub-1 col_2">2,194</td>
</tr>
<tr>
<th class="gw_stub gw__al_left" scope="row" id="stub-2">Seoul</th>
<td class="gw__al_right" headers="grp_asia stub-2 col_1">9.74</td>
<td class="gw__al_right" headers="grp_asia stub-2 col_2">605</td>
</tr>
</tbody>
<tbody>
<tr>
<th colspan="3" scope="colgroup" class="gw_group_label gw__al_left" id="grp_europe">
Europe
</th>
</tr>
<tr>
<th class="gw_stub gw__al_left" scope="row" id="stub-3">London</th>
<td class="gw__al_right" headers="grp_europe stub-3 col_1">8.98</td>
<td class="gw__al_right" headers="grp_europe stub-3 col_2">1,572</td>
</tr>
<tr>
<th class="gw_stub gw__al_left" scope="row" id="stub-4">Paris</th>
<td class="gw__al_right" headers="grp_europe stub-4 col_1">2.16</td>
<td class="gw__al_right" headers="grp_europe stub-4 col_2">105</td>
</tr>
</tbody>
</table>
</div>\begin{tabular}{lrr}
\toprule
City & Pop (M) & Area (km²) \\
\midrule
\multicolumn{3}{l}{\bfseries Asia} \\
\midrule
Tokyo & 13.96 & 2,194 \\
Seoul & 9.74 & 605 \\
\midrule
\multicolumn{3}{l}{\bfseries Europe} \\
\midrule
London & 8.98 & 1,572 \\
Paris & 2.16 & 105 \\
\bottomrule
\end{tabular}#block[
#set align(left)
#table(
columns: (auto, auto, auto,),
align: (left, right, right,),
stroke: none,
table.header(
[#text(weight: "bold")[City]],
[#text(weight: "bold")[Pop \(M\)]],
[#text(weight: "bold")[Area \(km²\)]],
table.hline(stroke: 0.5pt),
),
table.hline(stroke: 0.5pt),
table.cell(colspan: 3, fill: luma(240))[#text(weight: "bold")[Asia]],
table.hline(stroke: 0.5pt),
[Tokyo],
[13\.96],
[2\,194],
[Seoul],
[9\.74],
[605],
table.hline(stroke: 0.3pt),
table.hline(stroke: 0.5pt),
table.cell(colspan: 3, fill: luma(240))[#text(weight: "bold")[Europe]],
table.hline(stroke: 0.5pt),
[London],
[8\.98],
[1\,572],
[Paris],
[2\.16],
[105],
)
]┌────────────┬────────────┬────────────┐
│ City │ Pop (M) │ Area (km²) │
├────────────┴────────────┴────────────┤
│ Asia │
├────────────┬────────────┬────────────┤
│ Tokyo │ 13.96 │ 2,194 │
│ Seoul │ 9.74 │ 605 │
├────────────┴────────────┴────────────┤
│ Europe │
├────────────┬────────────┬────────────┤
│ London │ 8.98 │ 1,572 │
│ Paris │ 2.16 │ 105 │
└────────────┴────────────┴────────────┘