我如何将两个单元格垂直对齐在一起.目前,第二个单元格呈现在第一个单元格下方.第一个单元格是图像,第二个单元格是文本.这是我的代码.
private Document pdoc; Font font99 = FontFactory.GetFont("HELVETICA",60); PdfPTable pdfratingTable = new PdfPTable(2); PdfPCell pRatCell = null; pdfratingTable.WidthPercentage = 100; pdfratingTable.SetWidths(new int[] { 75,25 }); hImage = iTextSharp.text.Image.GetInstance(MapPath("~/Images/fyler3_rating.jpg")); NewWidth = 338; MaxHeight = 18; if (hImage.Width <= NewWidth) { NewWidth = hImage.Width; } NewHeight = hImage.Height * NewWidth / hImage.Width; if (NewHeight > MaxHeight) { NewWidth = hImage.Width * MaxHeight / hImage.Height; NewHeight = MaxHeight; } ratio = hImage.Width / hImage.Height; hImage.ScaleAbsolute(NewWidth,NewHeight); pRatCell = new PdfPCell(hImage); pRatCell.Border = 0; pRatCell.PaddingLeft = 20f; pRatCell.HorizontalAlignment = Element.ALIGN_LEFT; pdfratingTable.AddCell(pRatCell); pRatCell = new PdfPCell(new Phrase(new Chunk("405",font99))); pRatCell.HorizontalAlignment = Element.ALIGN_LEFT; pRatCell.Border = 0; pRatCell2.VerticalAlignment = Element.ALIGN_TOP; pdfratingTable.AddCell(pRatCell); pdoc.Add(pdfratingTable);
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。