← All updates

Row spans in DSL tables

A table cell can now cover several rows with attr.rowspan — the surrounding rows make room for it, stay together across a page break, and the tagged PDF carries /RowSpan and /ColSpan.

tablesdslaccessibility

Table cells in DSL templates can now span rows. Set attr.rowspan on a cell inside a row that shares its attr.grid with the rows below it, and leave the covered cell out of those rows:

col(
  { class: "table" },
  r(
    { grid: ["28%", "22%", "22%", "28%"] },
    col({ class: "table-cell", rowspan: 3 }, s("North")),
    col({ class: "table-cell" }, s("Revenue")),
    col({ class: "table-cell" }, s("$120,000")),
    col({ class: "table-cell" }, s("up 4%"))
  ),
  r(
    { grid: ["28%", "22%", "22%", "28%"] },
    col({ class: "table-cell" }, s("Costs")),
    col({ class: "table-cell" }, s("$80,000")),
    col({ class: "table-cell" }, s("up 2%"))
  )
);

The engine gives the spanning cell the summed height of the rows it covers, and grows those rows when the cell's content needs more room, so the text inside it wraps normally. Rows tied together by a span are treated as one unit when the document paginates: they move to the next page together, and a group taller than a page overflows with the usual page-split warning instead of failing the render.

The tagged PDF now carries the standard table attributes: /RowSpan on a cell that spans rows and /ColSpan on one that spans columns, in one /O /Table attribute dictionary. The DSL skill has a new row-span section and the catalog validator reports a span that reaches past the last row of its table run.