public static void AligmentColumn(RtfTable table, int column, int row1, int row2, HorizontalAlignment alignment, int fontSize = 12) { try { for (var i = row1; i <= row2; i++) { table.Cell(i, column).HorizontalAlignment = alignment; table.Cell(i, column).DefaultCharFormat.FontSize = fontSize; } } catch (Exception ex) { throw ex; } }
private static void old_CreateTableTitle(RtfTable table) { for (var j = 0; j < table.ColCount; j++) { for (var i = 0; i < 2; i++) { table.Cell(i, j).DefaultCharFormat.FontStyle.AddStyle(FontStyleFlag.Bold); } } RTFWorkingProvider.AddTextToCell(0, 0, table, "№ п/п"); RTFWorkingProvider.AddTextToCell(0, 1, table, "Идентификатор"); RTFWorkingProvider.AddTextToCell(0, 2, table, "Тип велопарковки"); RTFWorkingProvider.AddTextToCell(0, 3, table, "Вид велопарковки"); RTFWorkingProvider.AddTextToCell(0, 4, table, "Статус"); RTFWorkingProvider.AddTextToCell(0, 5, table, "Длина, м"); RTFWorkingProvider.AddTextToCell(0, 6, table, "Ширина, м"); RTFWorkingProvider.AddTextToCell(0, 7, table, "Количество секций"); RTFWorkingProvider.AddTextToCell(0, 8, table, "Дата установки"); RTFWorkingProvider.AddTextToCell(0, 9, table, "Дата обслуживания"); for (var i = 0; i < table.ColCount; i++) { RTFWorkingProvider.AddTextToCell(1, i, table, (i + 1).ToString()); } }
public static void AddTextToCell(int row, int col, RtfTable table, string text) { var paragraph = table.Cell(row, col).AddParagraph(); paragraph.Text = text; }