ConsoleTable 1.0.1
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package ConsoleTable --version 1.0.1
NuGet\Install-Package ConsoleTable -Version 1.0.1
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" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConsoleTable --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ConsoleTable, 1.0.1"
#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.
// Install ConsoleTable as a Cake Addin #addin nuget:?package=ConsoleTable&version=1.0.1 // Install ConsoleTable as a Cake Tool #tool nuget:?package=ConsoleTable&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ConsoleTable
A library for simple table formatting
Install
PM
Install-Package ConsoleTable
.NET CLI
dotnet add package ConsoleTable --version 1.0.0
Example usage
var table = new Table()
.AddColumn("#", "Name", "Surname", "Growth")
.AddRow(1, "Name1", "Surname1", "120")
.AddRow(2, "Name2", "Surname2", "10")
.AddRow(3, "Name333333", "Surname3333", "0");
Console.WriteLine(table);
Console Output
Example usage
Aligning each columns on different positions(Left,Right,Center)
var table = new Table()
.AddColumn("#", "Name", "Surname", "Growth")
.AddAlignment(Alignment.Center,2)
.AddAlignment(Alignment.Right,3)
.AddRow(1, "Name1", "Surname1", "120")
.AddRow(2, "Name2", "Surname2", "10")
.AddRow(3, "Name333333", "Surname33333333asdasd", "0");
Console.WriteLine(table);
Console Output
Example usage
Using custom formatting for each column
var table = new Table()
.AddColumn("#", "Name", "Surname", "Growth", "Birth date")
.AddCustomFormat(typeof(decimal), "{0:0.00}")
.AddCustomFormat(4,"{0:yyyy.MM.dd}")
.AddRow(1, "Name1", "Surname1", 120.95M,DateTime.Parse("02/02/2002 00:00:00"))
.AddRow(2, "Name2", "Surname2", 10.31123M,DateTime.Parse("05/02/2003"))
.AddRow(3, "Name333333", "Surname33333333asdasd",13.2M,DateTime.Parse("05/02/2012"));
Console.WriteLine(table);
Console Output
Example usage
Using nested tables and rows
var table = new Table()
.AddColumn("#", "Name","Surname")
.AddRow(1, "First name","Surname one")
.AddRowWithoutColumn("Products: ")
.AddRowWithoutColumn("Anything text", RowOrder.After);
var table2 = new Table()
.AddColumn("#", "Product name")
.AddRow(1, "Beer")
.AddRow(2, "M16A4")
.SetStandardPadding(10);
table.AddTable(table2)
.AddRow(2,"Second name","Surname two")
.AddTable(table2)
.AddRowWithoutColumn("Products: ")
.AddRowWithoutColumn("Anything text", RowOrder.After)
.AddRow(3,"3d name","Surname three")
.AddRowWithoutColumn("Anything text", RowOrder.After)
.AddTable(table2)
.AddRowWithoutColumn("Products: ")
.SetAutoInsteadForNestedTables(false)
.AddAlignment(Alignment.Center,1)
.AddSeparatorForEachRow();
Console.WriteLine(table.ToString());
Console Output
See more in ExampleProject
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- 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.
Fixed resulting table with different cultures