You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mitch Talmadge edited this page May 1, 2019
·
4 revisions
You can modify certain properties of the table to change its appearance. These can be configured in-line like everything else, and can even be changed after outputting the table if you want to make more tables based on the same data with different configurations.
Format
The characters that make up a table can be modified to your heart's content. Two formats are provided for you:
UTF8TableFormat is the original, double-pipe style format seen on the Getting Started page.
ASCIITableFormat uses only ASCII characters, like equals, pipe, and plus (=, |, +, etc.). It is better suited for displaying in consoles where UTF-8 is often not formatted well.
The default format if none is specified is UTF8TableFormat. To create your own format, please refer to the source code of the two included formats, as they can be confusing to create without examples. Extend the TableFormatAbstract class and inherit the methods.
To change formats, use the ASCIITable#withTableFormat(TableFormatAbstract format) method. For example, here are two formats of the same table:
Entire columns can be aligned left or right via the ASCIITable#alignColumn(int column, Align align) method.
The column number is 0 based and starts on the left side of the table. The options for Align are Align.LEFT and Align.RIGHT.
When you intentionally or accidentally pass a null value into a table, it will be displayed as an empty string by default. This behavior can be changed by using the withNullValue(String) method, as such: