https://github.com/thomashartm/tabletotext
Transformation of tables or tabluar information into a pretty printed text representation.
https://github.com/thomashartm/tabletotext
Last synced: 3 months ago
JSON representation
Transformation of tables or tabluar information into a pretty printed text representation.
- Host: GitHub
- URL: https://github.com/thomashartm/tabletotext
- Owner: thomashartm
- License: apache-2.0
- Created: 2016-01-03T22:58:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-05-12T09:13:57.000Z (about 3 years ago)
- Last Synced: 2024-12-28T15:29:24.942Z (5 months ago)
- Language: Java
- Size: 71.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TextToTable Formatter
The TextToTable library handles transformation of tables or tabluar information into a pretty printed text representation.#### How to render a simple table
The following example renders a very simple table with header and line numbers.
``` java
SimpleTextTable simpleTextTable = new SimpleTextTable(true, true);
simpleTextTable.addRow("Column Header 1", "Column Header 2", "Column Header 1");
simpleTextTable.addRow("Row 1 Value 1", "Row 1 Value 2", "Row 1 Value 3");
simpleTextTable.addRow("Row 2 Value 1", "Row 2 Value 2", "Row 2 Value 3");
simpleTextTable.addRow("Row 2 Value 1", "Row 2 Value 2", "Row 2 Value 3");System.out.println(simpleTextTable.printFormatted());
```The rendered table looks as follows.
``` bash
Column Header 1 Column Header 2 Column Header 1
--------------- --------------- ---------------
1 Row 1 Value 1 Row 1 Value 2 Row 1 Value 3
2 Row 2 Value 1 Row 2 Value 2 Row 2 Value 3
3 Row 2 Value 1 Row 2 Value 2 Row 2 Value 3
```