Skip to content

Multiple lines in cell #35

@fortnum

Description

@fortnum

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions