Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/minhhungit/ConsoleTableExt
A fluent library to print out a nicely formatted table in a console application C#
https://github.com/minhhungit/ConsoleTableExt
console console-table fluent text-table
Last synced: about 2 months ago
JSON representation
A fluent library to print out a nicely formatted table in a console application C#
- Host: GitHub
- URL: https://github.com/minhhungit/ConsoleTableExt
- Owner: minhhungit
- License: mit
- Created: 2017-11-23T10:06:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-18T22:23:40.000Z (5 months ago)
- Last Synced: 2024-09-19T01:40:05.627Z (3 months ago)
- Topics: console, console-table, fluent, text-table
- Language: C#
- Homepage:
- Size: 763 KB
- Stars: 329
- Watchers: 8
- Forks: 37
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-dotnet-core - ConsoleTableExt - Fluent library to create table for .NET console application. (Frameworks, Libraries and Tools / Misc)
- awesome-dotnet-core - ConsoleTableExt - 用于为.NET控制台应用程序创建表的Fluent库。 (框架, 库和工具 / 大杂烩)
- fucking-awesome-dotnet-core - ConsoleTableExt - Fluent library to create table for .NET console application. (Frameworks, Libraries and Tools / Misc)
- awesome-dotnet-core - ConsoleTableExt - Fluent library to create table for .NET console application. (Frameworks, Libraries and Tools / Misc)
README
# ConsoleTableExt [![Build status](https://ci.appveyor.com/api/projects/status/e4ugtobtcrjhk9p4?svg=true)](https://ci.appveyor.com/project/minhhungit/consoletableext)
A library to print out a nicely formatted table in a console application C#
### Nuget
> https://www.nuget.org/packages/ConsoleTableExt/### Feature
- Support [box-drawing characters](https://en.wikipedia.org/wiki/Box-drawing_character)
- Table alignment (left right and center)
- Column alignment (left/right/center)
- Table can have TITLE, can change text color and background color of title, support title alignment (left/right/center)
- Support power char-map, strong customization ability
- Contain some popular formas like Markdown table...
- Support text formatter (include header)
- Support many kind data type: DataTable, List...
- Support metadata row (placed at top or bottom of table)
- Column min-length
- support .NET Framework >= 3.5, .NET core
- ...### How to use:
```csharp
var tableData = new List>
{
new List{ "Sakura Yamamoto", "Support Engineer", "London", 46},
new List{ "Serge Baldwin", "Data Coordinator", "San Francisco", 28, "something else" },
new List{ "Shad Decker", "Regional Director", "Edinburgh"},
};
```**Simple example with default format:**
```csharp
ConsoleTableBuilder
.From(tableData)
.ExportAndWriteLine();
```**More example with existing format Alternative:**
```csharp
ConsoleTableBuilder
.From(tableData)
.WithFormat(ConsoleTableBuilderFormat.Alternative)
.ExportAndWriteLine(TableAligntment.Center);
```**Advance example with custom format using CharMap:**
```csharp
ConsoleTableBuilder
.From(tableData)
.WithTitle("CONTACTS ", ConsoleColor.Yellow, ConsoleColor.DarkGray)
.WithColumn("Id", "First Name", "Sur Name")
.WithMinLength(new Dictionary {
{ 1, 25 },
{ 2, 25 }
})
.WithTextAlignment(new Dictionary
{
{2, TextAligntment.Right }
})
.WithCharMapDefinition(new Dictionary {
{CharMapPositions.BottomLeft, '=' },
{CharMapPositions.BottomCenter, '=' },
{CharMapPositions.BottomRight, '=' },
{CharMapPositions.BorderTop, '=' },
{CharMapPositions.BorderBottom, '=' },
{CharMapPositions.BorderLeft, '|' },
{CharMapPositions.BorderRight, '|' },
{CharMapPositions.DividerY, '|' },
})
.WithHeaderCharMapDefinition(new Dictionary {
{HeaderCharMapPositions.TopLeft, '=' },
{HeaderCharMapPositions.TopCenter, '=' },
{HeaderCharMapPositions.TopRight, '=' },
{HeaderCharMapPositions.BottomLeft, '|' },
{HeaderCharMapPositions.BottomCenter, '-' },
{HeaderCharMapPositions.BottomRight, '|' },
{HeaderCharMapPositions.Divider, '|' },
{HeaderCharMapPositions.BorderTop, '=' },
{HeaderCharMapPositions.BorderBottom, '-' },
{HeaderCharMapPositions.BorderLeft, '|' },
{HeaderCharMapPositions.BorderRight, '|' },
})
.ExportAndWriteLine(TableAligntment.Right);
```Check more demo here https://github.com/minhhungit/ConsoleTableExt/blob/master/Src/ConsoleTableApp/Program.cs
### Char Map Definition
### Header Char Map
**There are many ways to contribute to ConsoleTableExt, either contribute issue/code directly or buy me a cup of coffee**
### Inspired by
- khalidabuhakmeh/ConsoleTables