我正在使用iTextSharp
在我的应用程序中创建PDF。但是,我必须重新创建一个表,在其中必须为一个很小的列设置大小。下面是显示我要设置列大小的图片:
当其余的表创建都正常时,我无法设置此宽度。
码:
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("Os óleos e gorduras vegetais velhos fornecidos são biomassa conforme o Decreto de biomassa.");
最佳答案
尝试使用此代码
PdfPTable table = new PdfPTable(new float[] { 30f, 400f });
table.HorizontalAlignment = 0;
table.TotalWidth = 500f;
table.LockedWidth = true;
table.SetWidths(widths);
关于c# - PdfPTable单元格宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22094190/