Import std.term.widgets
Table
class
Public Class Table
A table of text, with a header row or not, its columns as wide as their widest cell, which Render draws with a BorderStyle's lines. A cell can have several lines, and each column its own Alignment. With a MaxWidth, the widest columns give way first, down to their widest character, and their cells wrap.
Examples
Local table = Table("Name", "Age")
table.AddRow("Ada", "36")
table.AddRow("Alan", "41")
table.Align(1, Alignment.RIGHT)
Local text = table.Render()
Expect(table.RowCount == 2)
Expect(text.Contains("Ada") && text.Contains("41"))-
The lines it's drawn with.
-
How the header's cells look: bold, at first.
-
How the lines look.
-
The most columns it takes, lines and all, or 0 for as many as it needs.
-
The spaces on each side of a cell's text.
-
A table whose header row is
headers, or that has none, without any. -
How many rows it has, after its header.
-
Adds a row of
cells, from the first column. A row with fewercellsthan another has empty ones after them. -
Puts the
column's cells wherealignmentsays, the header's too. Panics for a column below 0. -
Its lines, with a line break between each two, styled as
colorsshows them, or plain for NONE. A table without a header or a row is "". -
Writes it to stdout, with a line break after, as stdout shows colors.
-
Writes it to
terminal, with a line break after, as it shows colors.
Report an issue with this page or with FutureBlitz on GitHub.