private void AddTableRows(TableBuilder tableBuilder, RowData[] rows, int columnCount, params int[] underlines) { for (int i = 0, l = rows.Length; i < l; i++) { RowData row = rows[i]; var tableRowBuilder = tableBuilder.AddRow(); tableRowBuilder .SetBorder(borderBuilder => { borderBuilder .SetLeftBorder(0, Stroke.None, Color.None) .SetTopBorder(0, Stroke.None, Color.None) .SetRightBorder(0, Stroke.None, Color.None); if (underlines.Contains(i)) { borderBuilder .SetBottomBorder(0.5f, Stroke.Solid, Color.Black); } else { borderBuilder .SetBottomBorder(row.BottomBorderWidth(), row.BottomBorderStroke(), Color.Black); } }); for (int j = 0; j < columnCount; j++) { var cellBuilder = tableRowBuilder.AddCell(); cellBuilder .SetHorizontalAlignment(j > 0 ? HorizontalAlignment.Right : HorizontalAlignment.Left) .SetVerticalAlignment(VerticalAlignment.Bottom); cellBuilder .SetPadding(0, 0, 0, 0); if (j < row.GetLength()) { row.AddTextToParagraph(cellBuilder.AddParagraph(), j); } else { cellBuilder .SetFont(row.GetLastFont()) .AddParagraphToCell(" "); } } } }
internal override void AddTextToParagraph(ParagraphBuilder paragraphBuilder, int index) { if (index > 0) { base.AddTextToParagraph(paragraphBuilder, index - 1); } else { for (int i = 0, l = firstCell.GetLength(); i < l; i++) { firstCell.AddTextToParagraph(paragraphBuilder, i); } } }