이미지를 셀의 오른쪽 하단에 정렬하려고합니다. 기본적으로 각 행에 대해 두 개의 셀이있는 테이블을 만듭니다. 셀에는 텍스트와 이미지가 포함되어 있는데,이 이미지는 셀의 오른쪽 하단에 정렬됩니다. (물론 텍스트의 위치에 영향을주지 않고) 이것은 내가 각 셀의 오른쪽 아래에있는 이미지를 배치하려면 어떻게해야 내 코드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
이와 열을 만들 수 있지만
정말 당신을 throw
을 가정합니다 ....하지 않을 경우 요소의 짝수의 employees
수집을했다 확인하지 않고 셀을 추가하기 때문에