A multi-page invoice table
Twelve lines is one page and thirty is two — and the second has to look exactly like the first, or the invoice comes back from the customer's accounts department.
A pad of printed stationery has the frame on the paper already: a box for the lines, a rule under it, the total below the rule. What goes in the box is a different length every time. An order of four lines leaves a hand's breadth of white above the rule and an order of a dozen fills it, so two sheets from the same pad look like two different documents — and the usual answer, padding the short one with empty rows, is a row somebody can write in afterwards.
Here the box is filled instead. Whatever room the lines leave is shared out among them in equal parts, once they have all been measured, so the last line lands on the bottom edge whichever order is being printed. The headings and the total stay exactly where the paper puts them. The two notes at the foot of the page do the same with words rather than rows: their lines are moved apart until each note reaches the bottom of its box, so notes of unequal length end on one line — and a limit is given along with the box, so a note of two lines keeps the spacing it came with.
Whole programs, hundreds of lines long, for whoever writes your software.
Read the Rust source Read the Python source
Twelve lines is one page and thirty is two — and the second has to look exactly like the first, or the invoice comes back from the customer's accounts department.
What a cell can do with its own box: the margin, the border, the space inside, the background.
A cell's four sides in four different colours, and coloured fills told apart from coloured borders.
A long table handed over whole, deciding for itself where the pages break: its heading on top of every page, its footnote under every page, its grey grounds stated once for the whole table, and a note you draw under each page at the exact place the table reports.
A specification sheet whose cells are merged down the rows: each group named once beside all of its rows, with one note beside them; the thin lines stop at those cells' edges, and a note too long for the rows it covers makes them grow.
One parts list twice: four columns sharing the width equally, then the reference, the quantity and the price each as wide as their own widest cell and the description given everything they leave.