Good morning,
I'm working with C # with the Itextsharp library.
Which by pressing a button creates a PDF and inside a small table where it shows the totals. I would like to know how I can align the contents of the cells in a centered way, because at the moment when initializing it, it shows it on the left side.
How can I make the alignment of the contents of the cells in the center.
My code to create the table is as follows:
var parrafo3 = new Paragraph("\r\n" + "\r\n" + "Total:", fuente);
document.Add(parrafo3);
PdfPTable table = new PdfPTable(9);
table.AddCell(new PdfPCell(new Paragraph(textBox19.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox20.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox21.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox22.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox23.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox24.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox25.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox26.Text, fuente3)));
table.AddCell(new PdfPCell(new Paragraph(textBox27.Text, fuente3)));
table.HorizontalAlignment = Element.ALIGN_CENTER;
//resto celdas
document.Add(table);
Thanks. Greetings