Grids: Rule Styles

Grids can support different styles for a rule (a horizontal line in the table). Currently defined styles for the table are:

  • normal - a normal rule

  • light - a rule rendered using light characters (e.g. lighter than normal)

  • strong - a rule rendered using strong characters (e.g. stronger than normal)

  • heavy - a rule rendered using heavy characters (e.g. heavy than strong)

The following example creates a table with rules of different styles and applies a grid supporting all styles to the table.

1
2
3
4
5
6
7
8
9
10
11
12
AsciiTable at = new AsciiTable();
at.addRule();
at.addRow("rc 11", "rc 12");
at.addLightRule();
at.addRow("rc 21", "rc 22");
at.addStrongRule();
at.addRow("rc 31", "rc 32");
at.addHeavyRule();
at.getContext().setWidth(13);

at.getContext().setGrid(A8_Grids.lineDoubleBlocks());
System.out.println(at.render());

The resulting output:

═════════════
 rc 11 rc 12
─────────────
 rc 21 rc 22
▓▓▓▓▓▓▓▓▓▓▓▓▓
 rc 31 rc 32
▀▀▀▀▀▀▀▀▀▀▀▀▀