I am working on a salary settlement format in c #, with itexsharp to generate the pdf file. But I can not control the alignment of the contents of the PdfPTable / PdfPCell cells.
I have this code:
/*datos del LA LIQUIDACIÓN*/ //1° linea phrase.Font = new Font(FontFactory.GetFont("Arial", 10, Font.BOLD)); phrase.Add("H A B E R E S"); PdfPCell cell2 = new PdfPCell(); cell2.Border = Rectangle.NO_BORDER; cell2.PaddingTop = -7; cell2.AddElement(phrase); cell2.Colspan = 3; cell2.HorizontalAlignment = PdfPCell.ALIGN_CENTER; table2.AddCell(cell2); phrase.Clear();
But it gives me this result (file capture): The content of the cell where the text "HABERES" is for example, I need to be aligned to the center, but it is aligned to the left.