Grids: New Grids

New grids can be defined as needed. The TA_Grid interface already provides a number of methods to create new grids.

The following example shows how a new gird is created and then added to a table.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
TA_Grid myGrid = TA_Grid.create("grid using UTF-8 light border characters")
                .addCharacterMap(TA_GridConfig.RULESET_NORMAL, ' ', '#', '&', '#', '#', '%', '%', '+', '+', '+', '#', '%')
;

AsciiTable at = new AsciiTable();
at.addRule();
at.addRow("rc 11", "rc 12");
at.addRule();
at.addRow("rc 21", "rc 22");
at.addRule();
at.getContext().setWidth(13);

at.getContext().setGrid(myGrid);
System.out.println(at.render());

The resulting output:

#############
&rc 11&rc 12&
+#####+#####+
&rc 21&rc 22&
%#####%#####%