ConsoleTable.Text 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ConsoleTable.Text --version 1.0.2
                    
NuGet\Install-Package ConsoleTable.Text -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConsoleTable.Text" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConsoleTable.Text" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="ConsoleTable.Text" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ConsoleTable.Text --version 1.0.2
                    
#r "nuget: ConsoleTable.Text, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ConsoleTable.Text@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ConsoleTable.Text&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=ConsoleTable.Text&version=1.0.2
                    
Install as a Cake Tool

ConsoleTable.Text

A lightweight .NET library for creating beautifully formatted console tables with customizable headers, rows, padding, and text alignment.

Features

  • Create formatted tables as a string with headers and data rows
  • Unicode box-drawing characters for clean borders
  • Automatic column width calculation
  • Configurable cell padding
  • Text alignment options (left/right) for headers and rows
  • Easy clearing and reusing of tables
  • Simple and intuitive API
  • Optimized for performance
  • Support for varying column counts across rows (each row can have its own number of cells).

Releases

Check releases for the changelog here https://github.com/BrunoVT1992/ConsoleTable/releases/

Installation

Package Manager

Install-Package ConsoleTable.Text

.NET CLI

dotnet add package ConsoleTable.Text

PackageReference

<PackageReference Include="ConsoleTable.Text" Version="1.0.0" />

nuget.org

Download this nuget package from https://www.nuget.org/packages/ConsoleTable.Text

Quick Start

using ConsoleTable.Text;

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" }
});

// Display the table
Console.WriteLine(table.ToTable());

Output:

┌─────────┬─────┬─────────────┐
│ Name    │ Age │ City        │
├─────────┼─────┼─────────────┤
│ Alice   │ 30  │ New York    │
├─────────┼─────┼─────────────┤
│ Bob     │ 25  │ Los Angeles │
├─────────┼─────┼─────────────┤
│ Charlie │ 47  │ Chicago     │
└─────────┴─────┴─────────────┘

API Reference

Properties

Property Type Default Description
Headers string[] Array.Empty<string>() The table headers. Headers are not required.
Rows List<string[]> new List<string[]>() All the data rows for the table. Rows are not required.
Padding int 1 The number of spaces on each side of cell content
HeaderTextAlignmentRight bool false When true, header text is right-aligned otherwise left aligned
RowTextAlignmentRight bool false When true, row text is right-aligned otherwise left aligned

Methods

Method Description
SetHeaders(params string[] headers) Sets the table headers. Calling this again will overwrite previous headers. Headers are not required.
AddRow(params string[] row) Adds a data row to the table. Rows are not required.
AddRows(params string[][] rows) Adds multiple data rows to the table. Rows are not required.
ClearRows() Removes all data rows from the table (headers are preserved).
Clear() Clear all the headers and rows from the table.
ToTable() / ToString() Returns the formatted table as a string.

Examples

Custom Padding

using ConsoleTable.Text;

var table = new Table { Padding = 10 };

table.SetHeaders("Name", "Age", "City");

table.AddRows(
    new string[] { "Alice", "30", "New York" },
    new string[] { "Bob", "25", "Los Angeles" },
    new string[] { "Charlie", "47", "Chicago" }
);

Console.WriteLine(table.ToTable());

Output:

┌───────────────────────────┬───────────────────────┬───────────────────────────────┐
│          Name             │          Age          │          City                 │
├───────────────────────────┼───────────────────────┼───────────────────────────────┤
│          Alice            │          30           │          New York             │
├───────────────────────────┼───────────────────────┼───────────────────────────────┤
│          Bob              │          25           │          Los Angeles          │
├───────────────────────────┼───────────────────────┼───────────────────────────────┤
│          Charlie          │          47           │          Chicago              │
└───────────────────────────┴───────────────────────┴───────────────────────────────┘

Text Alignment Right

using ConsoleTable.Text;

var table = new Table { HeaderTextAlignmentRight = true, RowTextAlignmentRight = true };

table.SetHeaders("Name", "Age", "City");

table.AddRows(
    new string[] { "Alice Cooper", "30", "New York" },
    new string[] { "Bob", "25", "Los Angeles" },
    new string[] { "Charlie Brown", "47", "Chicago" }
);

Console.WriteLine(table.ToTable());

Output:

┌───────────────┬─────┬─────────────┐
│          Name │ Age │        City │
├───────────────┼─────┼─────────────┤
│  Alice Cooper │  30 │    New York │
├───────────────┼─────┼─────────────┤
│           Bob │  25 │ Los Angeles │
├───────────────┼─────┼─────────────┤
│ Charlie Brown │  47 │     Chicago │
└───────────────┴─────┴─────────────┘

Table with inconsistent columns across rows

using ConsoleTable.Text;

var table = new Table();

table.SetHeaders("Name", "Age", "City");

table.AddRow("Alice");
table.AddRow("Bob", "25", "Antwerp", "Belgium");
table.AddRow("Charlie", "47", "Chicago");
table.AddRow("Karina", "33", "Lima", "Peru", "South-America");
table.AddRow("Jenny", "43");
table.AddRow("John");
table.AddRow("Johny");
table.AddRow();
table.AddRow(null!);
table.AddRow("Thomas", "33", "Brussels", "Belgium", "Europe", "Earth", "Solar System");
table.AddRow("Nathalie", "29", "Paris", "France", "Europe", "Earth", "Solar System");
table.AddRow("Mathias", "37", "Oslo", "Norway", "Europe", "Earth", "Solar System");
table.AddRow("Kenny", "55", "Tokyo");

Console.WriteLine(table.ToTable());

Output:

┌──────────┬─────┬──────────┐
│ Name     │ Age │ City     │
├──────────┼─────┴──────────┘
│ Alice    │
├──────────┼─────┬──────────┬─────────┐
│ Bob      │ 25  │ Antwerp  │ Belgium │
├──────────┼─────┼──────────┼─────────┘
│ Charlie  │ 47  │ Chicago  │
├──────────┼─────┼──────────┼─────────┬───────────────┐
│ Karina   │ 33  │ Lima     │ Peru    │ South-America │
├──────────┼─────┼──────────┴─────────┴───────────────┘
│ Jenny    │ 43  │
├──────────┼─────┘
│ John     │
├──────────┤
│ Johny    │
├──────────┤
│          │
├──────────┤
│          │
├──────────┼─────┬──────────┬─────────┬───────────────┬───────┬──────────────┐
│ Thomas   │ 33  │ Brussels │ Belgium │ Europe        │ Earth │ Solar System │
├──────────┼─────┼──────────┼─────────┼───────────────┼───────┼──────────────┤
│ Nathalie │ 29  │ Paris    │ France  │ Europe        │ Earth │ Solar System │
├──────────┼─────┼──────────┼─────────┼───────────────┼───────┼──────────────┤
│ Mathias  │ 37  │ Oslo     │ Norway  │ Europe        │ Earth │ Solar System │
├──────────┼─────┼──────────┼─────────┴───────────────┴───────┴──────────────┘
│ Kenny    │ 55  │ Tokyo    │
└──────────┴─────┴──────────┘

Write a Table Fluent

using ConsoleTable.Text;

 var tableString = new Table()
    .SetHeaders("Name", "Age", "City")
    .AddRow("Alice Cooper", "30", "New York")
    .AddRows(
        new string[] { "Bob", "25", "Los Angeles" },
        new string[] { "Charlie Brown", "47", "Chicago" }
    )
    .ToTable();

Console.WriteLine(tableString);

Output:

┌───────────────┬─────┬─────────────┐
│ Name          │ Age │ City        │
├───────────────┼─────┼─────────────┤
│ Alice Cooper  │ 30  │ New York    │
├───────────────┼─────┼─────────────┤
│ Bob           │ 25  │ Los Angeles │
├───────────────┼─────┼─────────────┤
│ Charlie Brown │ 47  │ Chicago     │
└───────────────┴─────┴─────────────┘

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 437 12/9/2025
1.0.3 343 12/8/2025
1.0.2 292 12/7/2025
1.0.1 258 11/30/2025
1.0.0 260 11/30/2025