Max
Max

Reputation: 13338

Increase Height of last cell

I created a table using the iTextSharp.text.pdf library.

Table I created:

Table created with iTextSharp.text.pdf library

Code I used:

var signTable = new PdfPTable(2);
signTable.WidthPercentage = 65f;
signTable.HorizontalAlignment = Element.ALIGN_RIGHT;
signTable.SetWidths(new[] { 25, 40 });

//SignName
cell = new PdfPCell(new Phrase(_localizationService.GetResource("PDFPackagingSlip.SignName", lang.Id), font));
cell.BackgroundColor = BaseColor.LIGHT_GRAY;
cell.HorizontalAlignment = Element.ALIGN_LEFT;
signTable.AddCell(cell);

//creates empty cell
cell = new PdfPCell();
signTable.AddCell(cell);

//SignDate
cell = new PdfPCell(new Phrase(_localizationService.GetResource("PDFPackagingSlip.SignDate", lang.Id), font));
cell.BackgroundColor = BaseColor.LIGHT_GRAY;
cell.HorizontalAlignment = Element.ALIGN_LEFT;
signTable.AddCell(cell);

//creates empty cell
cell = new PdfPCell();
signTable.AddCell(cell);

//Signature
cell = new PdfPCell(new Phrase(_localizationService.GetResource("PDFPackagingSlip.Signature", lang.Id), font));
cell.BackgroundColor = BaseColor.LIGHT_GRAY;
cell.HorizontalAlignment = Element.ALIGN_LEFT;
signTable.AddCell(cell);

//creates empty cell
cell = new PdfPCell();
signTable.AddCell(cell);

//add table to pdf document. 
doc.Add(signTable);

Question

How can I increase the height of the last added empty cell?(cell in right bottom corner)

I tried using following code, but it didn't change anything:

signTable.Rows[2].SetExtraHeight(5, 80f);

Upvotes: 0

Views: 118

Answers (1)

rhens
rhens

Reputation: 4871

You can use

cell.MinimumHeight = 80f;

or

cell.FixedHeight = 80f;

Upvotes: 2

Related Questions