1
画像をセルの右下に揃えようとしています。 私は基本的に各行に2つのセルを持つテーブルを作成しています。セルには、テキストと画像が含まれています。これは、セルの右下に揃えたいものです。 (もちろん、テキストの位置に影響を与えずに)これは私が各セルの右下の画像を配置するにはどうすればよい私のコードiTextSharp PdfPCell画像をセルの一番下に合わせる
PdfPTable table = new PdfPTable(2);
table.TotalWidth = 400f;
table.LockedWidth = true;
float[] widths = new float[] { 1.5f, 1.5f };
table.SetWidths(widths);
table.HorizontalAlignment = 0;
table.SpacingBefore = 50f;
table.SpacingAfter = 30f;
iTextSharp.text.Image logoImage = iTextSharp.text.Image.GetInstance(HttpContext.Current.Server.MapPath("~/Images/MyImage.png"));
logoImage.ScaleAbsolute(40, 40);
logoImage.Alignment = iTextSharp.text.Image.ALIGN_BOTTOM;
logoImage.Alignment = iTextSharp.text.Image.RIGHT_ALIGN;
foreach (EmployeeModel employee in employees)
{
PdfPCell cell = new PdfPCell();
cell.FixedHeight = 140f;
cell.PaddingLeft = 30f;
cell.PaddingRight = 10f;
cell.PaddingTop = 20f;
cell.PaddingBottom = 5f;
Paragraph p = new Paragraph(GetLabelCellText(Employee), NormalFont);
p.Alignment = Element.ALIGN_LEFT;
p.Alignment = Element.ALIGN_TOP;
cell.AddElement(p);
cell.AddElement(logoImage);
table.AddCell(cell);
}
ある画像
を参照してください。あなたはTable
2で列を作成しますが、
は本当にあなたをthrow
を仮定します....ない場合は偶数個の要素は、employees
コレクションを持って検証せずにセルを追加するので