private void TextOnly(ParagraphBuilder paragraphBuilder, BoardingCell bi) { foreach (FontText ft in bi.fontTexts) { paragraphBuilder.AddText(ft.text).SetFont(ft.font); } }
private void FillBoardingTableFirstRow(TableBuilder tableBuilder, BoardingCell bi) { for (int k = 0; k < 2; k++) { var rowBuilder = tableBuilder.AddRow(); if (k == 1) { rowBuilder.ApplyStyle( StyleBuilder.New() .SetBorderBottom(0.5f, Stroke.Solid, Color.Black) .SetPaddingBottom(6) ); } var cellBuilder = rowBuilder.AddCell(); cellBuilder.SetColSpan(2); if (k == 0) { cellBuilder.SetFont(FNT9).AddParagraph(bi.name); } else { if (bi.image != null) { cellBuilder.AddTable(builder => { ImageThenText(builder, bi); }); } else { TextOnly(cellBuilder.AddParagraph(), bi); } } } }
private void ImageThenText(TableBuilder tableBuilder, BoardingCell bi) { tableBuilder .SetWidth(XUnit.FromPercent(100)) .SetBorder(Stroke.None) .AddColumnToTable("", 13) .AddColumn(""); var rowBuilder = tableBuilder.AddRow(); rowBuilder.AddCell() .SetPadding(0, 4, 0, 0) //.SetVerticalAlignment(VerticalAlignment.Bottom) .AddImage(Path.Combine("images", bi.image), XSize.FromWidth(11)); TextOnly(rowBuilder.AddCell().AddParagraph(), bi); }
private void FillBoardingTable(TableBuilder tableBuilder, BoardingCell[,] boardingItems, int startRow = 0) { tableBuilder .SetBorder(Stroke.None) .AddColumnPercentToTable("", 25) .AddColumnPercentToTable("", 25) .AddColumnPercentToTable("", 25) .AddColumnPercent("", 25); int rows = boardingItems.GetLength(0); int columns = boardingItems.GetLength(1); for (int i = startRow; i < rows; i++) { for (int k = 0; k < 2; k++) { var rowBuilder = tableBuilder.AddRow(); if (k == 0) { rowBuilder.ApplyStyle( StyleBuilder.New() .SetPaddingTop(4) ); } else if (i < rows - 1) { rowBuilder.ApplyStyle( StyleBuilder.New() .SetBorderBottom(0.5f, Stroke.Solid, Color.Black) .SetPaddingBottom(4) ); } for (int j = 0; j < columns; j++) { BoardingCell bi = boardingItems[i, j]; if (!bi.isEmpty()) { var cellBuilder = rowBuilder.AddCell(); if (bi.colSpan > 1) { cellBuilder.SetColSpan(bi.colSpan); } if (k == 0) { cellBuilder .AddParagraph(bi.name).SetFont(FNT9); } else { if (bi.image != null) { cellBuilder.AddTable(builder => { ImageThenText(builder, bi); }); } else { TextOnly(cellBuilder.AddParagraph(), bi); } } } } } } }