public override string ToString() { int totalLength = _longest.Values.Sum() + _longest.Values.Count * 3 + 2; string ret = ".".PadRight(totalLength - 2, '-') + ".\n"; // Printing title if there is one if (!Title.IsNullOrEmpty()) { ret += $"| {Title.Center(totalLength - 5)} |\n" + "|".PadRight(totalLength - 2, '-') + "|\n"; } // Printing headers if has some Headings.ForEachWithIndex((i, h) => { ret += $"| {h.Center(_longest[i])} "; if (Headings.Length - 1 == i) { ret += "|\n" + "|".PadRight(totalLength - 2, '-') + "|\n"; } }); // Printing rows Rows.ForEachWithIndex((i, r) => { // Printing columns r.Columns.ForEachWithIndex((j, c) => { // Printing data if (c.Align == Column.Alignment.Left) { ret += $"| {c.Text.PadRight(_longest[j])} "; } else { ret += $"| {c.Text.PadLeft(_longest[j])} "; } }); ret += "|\n"; }); // Closing table ret += "'".PadRight(totalLength - 2, '-') + "'"; return(ret); }