• Stars
    star
    295
  • Rank 140,902 (Top 3 %)
  • Language
    C#
  • License
    MIT License
  • Created about 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fluent library to print out a nicely formatted table in a console application C#

ConsoleTableExt Build status

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
  • 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:

    var tableData = new List<List<object>>
    {
        new List<object>{ "Sakura Yamamoto", "Support Engineer", "London", 46},
        new List<object>{ "Serge Baldwin", "Data Coordinator", "San Francisco", 28, "something else" },
        new List<object>{ "Shad Decker", "Regional Director", "Edinburgh"},
    };

    Simple example with default format:

    ConsoleTableBuilder
        .From(tableData)
        .ExportAndWriteLine();

    More example with existing format Alternative:

    ConsoleTableBuilder
        .From(tableData)
        .WithFormat(ConsoleTableBuilderFormat.Alternative)
        .ExportAndWriteLine(TableAligntment.Center);

    Advance example with custom format using CharMap:

    ConsoleTableBuilder
        .From(tableData)
        .WithTitle("CONTACTS ", ConsoleColor.Yellow, ConsoleColor.DarkGray)
        .WithColumn("Id", "First Name", "Sur Name")
        .WithMinLength(new Dictionary<int, int> {
            { 1, 25 },
            { 2, 25 }
        })
        .WithTextAlignment(new Dictionary<int, TextAligntment>
        {
            {2, TextAligntment.Right }
        })
        .WithCharMapDefinition(new Dictionary<CharMapPositions, char> {
            {CharMapPositions.BottomLeft, '=' },
            {CharMapPositions.BottomCenter, '=' },
            {CharMapPositions.BottomRight, '=' },
            {CharMapPositions.BorderTop, '=' },
            {CharMapPositions.BorderBottom, '=' },
            {CharMapPositions.BorderLeft, '|' },
            {CharMapPositions.BorderRight, '|' },
            {CharMapPositions.DividerY, '|' },
        })
        .WithHeaderCharMapDefinition(new Dictionary<HeaderCharMapPositions, char> {
            {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

    Buy Me a Coffee at ko-fi.com

    Inspired by

More Repositories

1

mongodb-cluster-docker-compose

Demo a simple sharded Mongo Cluster with a replication using docker compose
C#
262
star
2

github-action-rss-crawler

Rss 100% auto crawling using Github Action
HTML
21
star
3

kafka-kraft-cluster-docker-compose

workable kafka cluster with kraft mode using docker-compose
C#
17
star
4

AppCfg.Net

Type-safe, easy and power configuration framework for .NET developers
C#
11
star
5

DatabaseMigrateExt

A disciplined way to manage FluentMigration project and track change of stored procedures, sql function...
C#
8
star
6

SerenitySkins

Skin builder for Serenity framework
JavaScript
6
star
7

DotNetCurryMagazineStore

http://www.dotnetcurry.com/magazine/
4
star
8

WebSummarizerTranslatorChromeExtension

This Chrome Extension offers users powerful AI-driven features to summarize, translate, correct English, and pronounce text directly from any webpage.
JavaScript
3
star
9

MsmqExts

MSMQ (Microsoft Message Queuing) helper library
C#
2
star
10

ModuleTopology

C#
1
star
11

Wox.Plugin.MyFeedReader

A wox plugin help us read rss feed
C#
1
star
12

DemoVerySimpleCqrs

very simple demo of cqrs +event sourcing + ddd with just some line codes using Cirqus library
C#
1
star
13

Tsig

Twitter Snowflake-alike ID generator API demo application
C#
1
star
14

SimpleFeedlyChatDemo

C#
1
star
15

UrlContentExtractor

Extract web content with ease using Trafilatura's python tool, now accessible via a simple and intuitive API. Useful for Large Language Models (LLMs) and other applications requiring high-quality web data
PowerShell
1
star
16

msmq-grafana-dashboard

msmq-grafana msmq-exporter
PowerShell
1
star