Table layout: draws a grid of cells with optional header row.
Used by PrawnEx.table/3. Rows are list of lists (or list of maps with consistent keys).
Options control position, column widths, row height, padding, and header styling.
Summary
Functions
Draws a table on the document at the given position.
Functions
@spec layout(PrawnEx.Document.t(), [list()], keyword()) :: PrawnEx.Document.t()
Draws a table on the document at the given position.
Options
:at-{x, y}top-left of table (required). PDF coordinates: y is from bottom.:column_widths- list of widths in pt, or:autoto split page width equally:row_height- height of each row in pt (default 24):cell_padding- padding inside each cell (default 6):header- if true, first row is styled as header (default true when rows present):border- draw cell borders (default true):font_size- body font size (default 10):header_font_size- header row font size (default 11):align- cell alignment::left(default),:center, or:rightfor all cells; or a list per column e.g.[:left, :center, :right]:page_size- for:autocolumn widths (default :a4)
Examples
rows = [["Product", "Qty", "Price"], ["Widget", "2", "$10"], ["Gadget", "1", "$25"]]
doc
|> PrawnEx.table(rows, at: {50, 650}, column_widths: [200, 80, 80], header: true)