Example #1
0
        public void Render(ITablePrinter tablePrinter, IReadOnlyList <ColumnX> columns)
        {
            for (int lineIndex = 0; lineIndex < Size.Height; lineIndex++)
            {
                Border?.RenderRowLeftBorder(tablePrinter);

                for (int columnIndex = 0; columnIndex < Cells.Count; columnIndex++)
                {
                    CellX cellX    = Cells[columnIndex];
                    Size  cellSize = CalculateCellSize(columns, columnIndex, cellX.HorizontalMerge);

                    cellX.RenderNextLine(tablePrinter, cellSize);

                    bool isLastCell = columnIndex >= Cells.Count - 1;

                    if (isLastCell)
                    {
                        Border?.RenderRowRightBorder(tablePrinter);
                    }
                    else
                    {
                        Border?.RenderRowInsideBorder(tablePrinter);
                    }
                }

                tablePrinter.WriteLine();
            }
        }
Example #2
0
        public static RowX CreateFrom(FooterRow footerRow)
        {
            if (footerRow == null)
            {
                throw new ArgumentNullException(nameof(footerRow));
            }

            CellX cellX = CellX.CreateFrom(footerRow.FooterCell);

            cellX.HorizontalMerge = int.MaxValue;

            RowX rowX = new()
            {
                Border = footerRow.ParentDataGrid?.Border.IsVisible == true
                    ? DataGridBorderX.CreateFrom(footerRow.ParentDataGrid.Border)
                    : null,
                Cells = new List <CellX>
                {
                    cellX
                }
            };

            rowX.CalculateLayout();

            return(rowX);
        }
    }