RCi.PlainTextTable 1.1.2

dotnet add package RCi.PlainTextTable --version 1.1.2                
NuGet\Install-Package RCi.PlainTextTable -Version 1.1.2                
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="RCi.PlainTextTable" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RCi.PlainTextTable --version 1.1.2                
#r "nuget: RCi.PlainTextTable, 1.1.2"                
#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 RCi.PlainTextTable as a Cake Addin
#addin nuget:?package=RCi.PlainTextTable&version=1.1.2

// Install RCi.PlainTextTable as a Cake Tool
#tool nuget:?package=RCi.PlainTextTable&version=1.1.2                

RCi.PlainTextTable

.NET Plain text table builder.

Simple Example

var ptt = new PlainTextTable();
ptt.AppendRow("First Name", "Second Name", "Age");
ptt.AppendRow("Erin", "Zhang", 35);
ptt.AppendRow("Nalani", "David", 22);
ptt.AppendRow("Lexi", "Kim", 47);
+------------+-------------+-----+
| First Name | Second Name | Age |
+------------+-------------+-----+
| Erin       | Zhang       | 35  |
+------------+-------------+-----+
| Nalani     | David       | 22  |
+------------+-------------+-----+
| Lexi       | Kim         | 47  |
+------------+-------------+-----+

Complex Example

var ptt = new PlainTextTable
{
    BorderStyle = BorderStyle.UnicodeDouble,
    DefaultHorizontalAlignment = HorizontalAlignment.Right,
};

// append new row (returns row)
ptt.AppendRow("Accounts")
    // select first cell in this row (returns cell)
    .First()
    // set column span (returns cell)
    .SetColumnSpan(3)
    // set horizontal alignment (returns cell)
    .SetCenterHorizontalAlignment();

// append new row (returns row)
ptt.AppendRow("Full Name", "Age", "USD", "EUR")
    // select first column in this row (returns cell)
    .First()
    // set column span for this cell (returns cell)
    .SetColumnSpan(2)
    // set horizontal alignment for this cell (returns cell)
    .SetCenterHorizontalAlignment();

// append new row (returns row)
ptt.AppendRow("Erin", "Zhang", 35, 123.45, 0);

// append new row (returns row)
ptt.AppendRow("Nalani", "David", 22, 0, 420.69);

// append new row (returns row)
ptt.AppendRow("Lexi", "Kim", 47, 523.44, 1999);

// append new row (returns row)
ptt.AppendRow("TOTAL", 646.89, 2419.69)
    // select first column in this row (returns cell)
    .First()
    // set column span for this cell (returns cell)
    .SetColumnSpan(3);

// select first column (returns column)
ptt.FirstColumn()
    // slice column (skip first and take until last) (returns column span)
    .Slice(2, ^1)
    // set horizontal alignment for this column span (returns column span)
    .SetLeftHorizontalAlignment()
    // move to the right (targeting 2nd column) (returns column span)
    .MoveRight()
    // set horizontal alignment for this column span (returns column span)
    .SetLeftHorizontalAlignment();

// select last column (returns column)
ptt.LastColumn()
    // skip first two rows (returns column span)
    .Skip(2)
    // set only right border (returns column span)
    .SetBorders(Borders.None with { Right = Border.Normal })
    // move to the left (targeting 2nd column from the end) (returns column span)
    .MoveLeft()
    // set only left border (returns column span)
    .SetBorders(Borders.None with { Left = Border.Normal });

// select last row (returns row)
ptt.FirstRow()
    // set uniform bold border for all cells in this row (returns row)
    .SetBorders(Border.Bold)
    // move down to the second row (returns row)
    .MoveDown()
    // set uniform bold borders for the whole row (returns row)
    .SetBorders(Border.Bold)
    // move down to the last row (returns row)
    .MoveDownToLast()
    // set uniform bold borders for the whole row (returns row)
    .SetBorders(Border.Bold);
╔══════════════════════╗                   
║       Accounts       ║                   
╠════════════════╦═════╬════════╦═════════╗
║   Full Name    ║ Age ║    USD ║     EUR ║
╚════════╤═══════╩═════╩════════╩═════════╝
│ Erin   │ Zhang │  35 │ 123.45         0 │
├────────┼───────┼─────┤                  │
│ Nalani │ David │  22 │      0    420.69 │
├────────┼───────┼─────┤                  │
│ Lexi   │ Kim   │  47 │ 523.44      1999 │
╔════════╧═══════╧═════╦════════╦═════════╗
║                TOTAL ║ 646.89 ║ 2419.69 ║
╚══════════════════════╩════════╩═════════╝
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

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

Version Downloads Last updated
1.1.2 424 11/27/2024
1.1.1 102 11/27/2024
1.1.0 97 11/27/2024
1.0.0 109 11/26/2024