Reputation: 47
table.AddCell(new Paragraph("Sample text", font));
How can I set this text to center of the cell and add background of cell?
Upvotes: 0
Views: 131
Reputation: 3798
Here is the sample code for it:
PdfPCell c;
c = new PdfPCell(new Paragraph(@"Sample text", font));
c.HorizontalAlignment = Element.ALIGN_CENTER;
c.VerticalAlignment = Element.ALIGN_MIDDLE;
c.BackgroundColor = iTextSharp.text.Color.BLACK;
table.AddCell(c);
Hope this will work..
Upvotes: 2