Esempio n. 1
0
 public Table AddHeaders(TableHeader header1, TableHeader header2, TableHeader header3, TableHeader header4)
 {
     Headers.Add(header1);
     Headers.Add(header2);
     Headers.Add(header3);
     Headers.Add(header4);
     return(this);
 }
Esempio n. 2
0
        public static Table Table(TableHeader header1, TableHeader header2, TableHeader header3, TableHeader header4, TableHeader header5)
        {
            var table = new Table();

            table.AddHeaders(header1, header2, header3, header4, header5);

            return(table);
        }
Esempio n. 3
0
        public static Table Table(TableHeader header1, TableHeader header2, TableHeader header3, TableHeader header4)
        {
            Table table = Table();

            table.AddHeaders(header1, header2, header3, header4);

            return(table);
        }
Esempio n. 4
0
        internal void AppendTableHeader(IList <TableHeader> headers, int columnCount, IList <int> widths = null)
        {
            for (int i = 0; i < columnCount; i++)
            {
                AppendTableRowStart(i);

                AppendTablePadding();

                string name = headers[i].Name;

                Append(name);

                if (FormatTableHeader)
                {
                    int width        = name.Length;
                    int minimalWidth = width;

                    if (FormatTableHeader)
                    {
                        minimalWidth = Math.Max(minimalWidth, 3);
                    }

                    AppendPadRight(width, widths?[i], minimalWidth);
                }

                AppendTableCellEnd(i, columnCount);
            }

            AppendLine();

            for (int i = 0; i < columnCount; i++)
            {
                TableHeader header = headers[i];

                AppendTableRowStart(i);

                if (header.Alignment == Alignment.Center)
                {
                    AppendRaw(":");
                }
                else
                {
                    AppendTablePadding();
                }

                AppendRaw("---");

                if (FormatTableHeader)
                {
                    AppendPadRight(3, widths?[i] ?? headers[i].Name.Length, 3, '-');
                }

                if (header.Alignment != Alignment.Left)
                {
                    AppendRaw(":");
                }
                else
                {
                    AppendTablePadding();
                }

                if (i == columnCount - 1)
                {
                    AppendTableOuterPipe();
                }
            }

            AppendLine();
        }
Esempio n. 5
0
 public MarkdownBuilder AppendTable(TableHeader header1, TableHeader header2, TableHeader header3, TableHeader header4, TableHeader header5, IEnumerable <TableRow> rows)
 {
     AppendTable(new TableHeaderCollection()
     {
         header1, header2, header3, header4, header5
     }, rows);
     return(this);
 }
Esempio n. 6
0
 public Table AddHeader(TableHeader header)
 {
     Headers.Add(header);
     return(this);
 }