minhhungit / ConsoleTableExt

A fluent library to print out a nicely formatted table in a console application C#
MIT License
331 stars 37 forks source link

Multiple lines in cell #35

Open fortnum opened 3 years ago

fortnum commented 3 years ago

Sorry, I can't figure out, do ConsoleTableExt have any support of multiple lines in cell? Just now as I see, when I try to use the "first" + Environment.NewLine + "second" text in cell, the line wraps not inside the cell, but on the new line of whole formatted table output. Is it possible to format table like in https://github.com/seleznevae/libfort? The libfort unfortunately is in C (

Maybe there is a way to do it in ConsoleTableExt?

This code:

public static string GetAsciiTable()
{
    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"},
    };

    return ConsoleTableBuilder.From(tableData)
        .WithColumn("AAA BBB", "CCC" + Environment.NewLine + "DDD", "EEE FFF")
       .Export().ToString();
}

Results in this output:

ss

And the C libfort library multiline output for example:

color_table

minhhungit commented 3 years ago

No sir, multi lines has not supported yet