Goran Bibic

Goran Bibic

  • 480
  • 2.9k
  • 198.3k

Itext Sharp Column Aligment C#

Jul 19 2022 9:07 AM

This code working fine

In line 7 and 8 are aligment for complete columns in table

How to set up each column alignment?

First column center, second column left, third column right

 //Adding Header row
foreach (DataGridViewColumn column in ItemsDataGridView.Columns)
{
PdfPCell cell = new PdfPCell(new Phrase(column.HeaderText, calibri10bold3));
cell.HorizontalAlignment = Element.ALIGN_CENTER;
cell.VerticalAlignment = Element.ALIGN_CENTER;
cell.BackgroundColor = new iTextSharp.text.BaseColor(243, 70, 5);
pdfTable.AddCell(cell);
}

Answers (2)