How can I measure a table cell size to draw a vertical line as long as the cell height?

A solution using grid strokes instead of trying to measure the grid and add lines could look like this:

#let row(year, body, last: false) = (
  grid.cell(colspan: 2, align: center, year),
  grid.cell(rowspan: 2, inset: (bottom: 4pt), body),
  grid.cell(stroke: if not last { (right: 1pt) }, none),
  none,
)

// Does not work as desired
#grid(
  columns: (0.5fr, 0.5fr, 10fr),
  row-gutter: 6pt,
  ..row([2025], lorem(100)),
  ..row([2024], lorem(100), last: true),
)

Basically I split the 1fr column into two 0.5fr columns, so that I can add a stroke in the middle. To make the stroke as high as the leftover space from the main body, the main body goes into a cell with rowspan: 2.

The last cell gets all the leftover space, so this works because the stroke is added at the bottom. It wouldn’t work if you wanted the year at the bottom and stroke at the top.

5 Likes