【发布时间】:2015-09-24 11:28:42
【问题描述】:
下面是我正在使用的代码。我想要一个宽度为 40 的表,并且在该表内,还有另一个宽度为 25 的表。无论我给内表赋予什么值,它似乎都有一个固定的宽度。它尝试了不同的选项,例如“LockedWidth”,但这会使表格变得非常小。可以请任何人帮忙。
PdfPTable outerTable = new PdfPTable(1) { HorizontalAlignment = 0 };
outerTable.TotalWidth = 40;
PdfPCell outerTableColumn = new PdfPCell()
{
FixedHeight = 20,
BackgroundColor = new BaseColor(217, 83, 79)
};
PdfPTable innerTable = new PdfPTable(1) { HorizontalAlignment = 0 };
innerTable.TotalWidth = 28;
PdfPCell innerTableColumn = new PdfPCell()
{
FixedHeight = 15,
BackgroundColor = new BaseColor(92, 184, 92)
};
innerTable.AddCell(innerTableColumn);
outerTableColumn.AddElement(innerTable);
outerTable.AddCell(outerTableColumn);
【问题讨论】:
标签: c# pdf-generation itextsharp