TableWriter

Defines table writer.

Usage

Below is an example of how to create, configure, and use the default TableWriter.

// Build table with first row as table header
val table = t2.TableBuilder()
 .add("#", "Effective Date", "Currency Code", "Exchange Rate")
 .add("1", "2021-01-04", "USD", "0.690236")
 .add("2", "2021-01-05", "USD", "0.690627")
 .add("3", "2021-01-06", "USD", "0.689332")
 .build()

// Create table writer with supplied configuration
val writer = t2.TableWriter(
 "ansiColorEnabled" -> "true",
 "tableBorderColor" -> "cyan",
 "tableHeaderColor" -> "black,yellowBackground",
 "bodyRuleColor"    -> "yellow",
 "rowHeaderEnabled" -> "true",
 "rowHeaderColor"   -> "bold,cyan",
 "columnRightAlign" -> "0,3" // Right align first and last columns
)

// Write table to stdout
writer.write(System.out, table)

The table writer can be configured for changing such things as cell padding, character used for table borders, and more.

See also:
Companion:
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def write(out: Writer, table: Table): Unit

Writes table to given output.

Writes table to given output.

Value parameters:
out

output writer

table

input table

Concrete methods

def write(out: OutputStream, table: Table): Unit

Writes table to given output.

Writes table to given output.

Value parameters:
out

output stream

table

input table