这对我来说效果很好:http://code.google.com/p/java-ascii-table/
String [] header = {
"User Name",
"Salary", "Designation",
"Address", "Lucky#"
};
String[][] data = {
{ "Ram", "2000", "Manager", "#99, Silk board", "1111" },
{ "Sri", "12000", "Developer", "BTM Layout", "22222" },
{ "Prasad", "42000", "Lead", "#66, Viaya Bank Layout", "333333" },
{ "Anu", "132000", "QA", "#22, Vizag", "4444444" },
{ "Sai", "62000", "Developer", "#3-3, Kakinada" },
{ "Venkat", "2000", "Manager" },
{ "Raj", "62000"},
{ "BTC"},
};
这将呈现以下内容:
+-----------+--------+-------------+------------------------+---------+
| User Name | Salary | Designation | Address | Lucky# |
+-----------+--------+-------------+------------------------+---------+
| Ram | 2000 | Manager | #99, Silk board | 1111 |
| Sri | 12000 | Developer | BTM Layout | 22222 |
| Prasad | 42000 | Lead | #66, Viaya Bank Layout | 333333 |
| Anu | 132000 | QA | #22, Vizag | 4444444 |
| Sai | 62000 | Developer | #3-3, Kakinada | |
| Venkat | 2000 | Manager | | |
| Raj | 62000 | | | |
| BTC | | | | |
+-----------+--------+-------------+------------------------+---------+