V2.0.0
New Properties
| Property |
Type |
Default |
Description |
Footers |
string[] |
Array.Empty<string>() |
The table footers. Footers are not required. |
FooterTextAlignmentRight |
bool |
false |
When true, footer text is right-aligned otherwise left aligned |
New Method
| Method |
Description |
SetFooters(params string[] footers) |
Sets the table footers. Calling this again will overwrite previous footers. Footers are not required. |
New Styling
- Headers now have a double bottom line to seperate them from the rows.
- Now an option to add footers to the table (optional). These are drawn without borders at the bottom.
- Footer text can be left or right aligned.
using ConsoleTable.Text;
// Setup the table
var table = new Table();
// Set headers
table.SetHeaders("Name", "Age", "City");
// Add rows
table.AddRow("Alice Cooper", "30", "New York");
table.AddRows(new string[][]
{
new string[] { "Bob", "25", "Los Angeles" },
new string[] { "Charlie Brown", "47", "Chicago" }
});
//Set footers
table.SetFooters("Total: 3", "Total Age: 102");
// Display the table
Console.WriteLine(table.ToTable());
Output:
┌───────────────┬────────────────┬─────────────┐
│ Name │ Age │ City │
├═══════════════┼════════════════┼═════════════┤
│ Alice Cooper │ 30 │ New York │
├───────────────┼────────────────┼─────────────┤
│ Bob │ 25 │ Los Angeles │
├───────────────┼────────────────┼─────────────┤
│ Charlie Brown │ 47 │ Chicago │
└───────────────┴────────────────┴─────────────┘
Total: 3 Total Age: 102
Performance Improvements
- Slightly improved performance when rendering large tables with many rows and columns.