Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
table.AddCell(new Paragraph("Sample text", font));
如何将此文本设置为单元格的中心并添加单元格的背景?
这是它的示例代码:
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);
希望这会奏效..