我正在使用 iTextSharp 以编程方式创建 PDF 并生成 PdfPTable。
在某些单元格中,我需要有一个超链接。
如果没有超链接,我可以水平和垂直对齐单元格中的文本,但是当我添加包含我的超链接的块时,单元格会失去其对齐属性。
这是我的代码...
var webAddress = new Chunk(row["product_code"].ToString(), linkFont);
webAddress.SetAnchor(row["url"].ToString());
PdfPCell ProductCodeCell = new PdfPCell();
ProductCodeCell.AddElement(webAddress);
ProductCodeCell.VerticalAlignment = Element.ALIGN_MIDDLE;
ProductCodeCell.HorizontalAlignment = Element.ALIGN_CENTER;
ProductCodeCell.Padding = 3f;
table.AddCell(ProductCodeCell);
谁能帮我重新调整链接?
非常感谢。