pdfpcell 怎么设置单元格大小_PdfPTable单元格的宽度

在使用iTextSharp创建PDF时,遇到设置窄列宽度的问题。原始代码中,虽然表格整体宽度设置正常,但无法为特定列设定期望的宽度。通过修改代码,采用新的PdfPTable构造函数,传入一个包含各列宽度的数组,并设置表格的对齐方式、总宽度和锁定宽度,成功解决了单元格宽度设置问题。
摘要由CSDN通过智能技术生成

I'm using iTextSharp to create PDFs in my application. However I have to recreate a table, where I have to set the size for a very small column. Below is the picture that shows the size I want to set the column:

When the rest of the table creation all is well, I can't set this width.

Code:

PdfPTable table = new PdfPTable(2);

table.WidthPercentage = 82.0f;

PdfPCell cell = new PdfPCell(new Phrase("Com a assinatura autógrafa, o signatário desta Auto-declaração garante ter cumprido estas condições:", fontetexto));

cell.PaddingBottom = 10f;

cell.PaddingTop = 10f;

cell.Colspan = 2;

cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right

table.AddCell(cell);

table.AddCell("1. ");

table.AddCell(

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值