igni
igni

Reputation: 47

ItextSharp text operations

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

Answers (1)

Manish Parakhiya
Manish Parakhiya

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

Related Questions