A Timetable That Reports on Its Own Layout

When a table comes out wrong, the first question is why a column is so narrow or a row so tall. Here the library answers it. A morning bus timetable is laid out with every cell outlined in a thin line, and a note on each cell gives the library's own account of it. Under the table, a few lines count its columns and their widths, its heading, body and foot rows, what its cells hold, and, for each reason a row can take its height from, how many cells it applies to.

The second page shows what happens when things go wrong. A table with a row one cell short and a row too tall for its box is laid out anyway, and each fault is named underneath. A remark too long for one box is cut where a line ends and carried on in the next, with at least three lines on each side. The room left under a table's last row is shared out among its rows. Last, a table twice as wide as its box is shrunk whole into it, by one factor on both axes, and the page says by how much.

What This Example Shows

  • Every cell says why it has the size it has.
  • A faulty table laid out anyway, its faults named.
  • One row cut cleanly across two boxes.

The Source Code, Complete

Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library.

Read the Rust source Read the Python source

The Document Itself

Open the document in English Open the document in French Open the document in German Open the document in Spanish Open the document in Italian Open the document in Portuguese

A Timetable That Reports on Its Own Layout, first page

The Same Document in Other Languages

This document weighs 63.3 kB

Examples Near This One

A Multi-Page Invoice Table

Twelve invoice lines is one page and thirty is two, the second taking up the first's header and layout.

A Self-Paginating Table

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, a quarter's cell spanning its rows and written again at the top of the next page when a page cuts it, and a note you draw under each page at the exact place the table reports.

Cells Merged Down the Rows

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.

Columns Measured from Their Cells

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.

Every example, by subject