我正在尝试使用 itextsharp 创建 Pdf。我添加了一个包含两列的表,其中一列包含文本和其他图像。我想要恒定的图像大小
如果另一个单元格中的文本增加并且其他单元格中的图像大小不同,我的图像会自动调整大小
for (int i = 0; i < visitInfo.VisitsiteComplience.Count; ++i) { cellprop.Colspan = 1; cellprop.Pharse = visitInfo.VisitsiteComplience[i].Compliencedescription; cellprop.BaseColor = null; table.AddCell(AddCelltoTable(cellprop)); yesicon.ScaleAbsolute(35f, 35f); noicon.ScaleAbsolute(35f, 35f); if (visitInfo.VisitsiteComplience[i].Status == "1") { statuscell.AddElement(new Chunk(noicon, 0, 0)); } else { // statuscell.AddElement(new Chunk(noicon, 0, 0)); } statuscell.FixedHeight = 10; //headerLeftCell.Border = PdfPCell.NO_BORDER; table.AddCell(statuscell); }
2.然后我更改了代码,但现在图像大小增加并占据了整个单元格
for (int i = 0; i < visitInfo.VisitsiteComplience.Count; ++i)
{
cellprop.Colspan = 1;
cellprop.Pharse = visitInfo.VisitsiteComplience[i].Compliencedescription;
cellprop.BaseColor = null;
table.AddCell(AddCelltoTable(cellprop));
yesicon.ScaleAbsolute(35f, 35f);
noicon.ScaleAbsolute(35f, 35f);
if (visitInfo.VisitsiteComplience[i].Status == "1")
{
statuscell.AddElement(new Chunk(noicon, 0, 0));
}
else
{
// statuscell.AddElement(new Chunk(noicon, 0, 0));
}
//headerLeftCell.Border = PdfPCell.NO_BORDER;
table.AddCell(statuscell);
}