B. Krinsky
B. Krinsky

Reputation: 81

Why is alignment still bottom after setting vertical alignment to middle?

I have a table that I'm adding cells to.

for each cell I set the vertical alignment like so:

PdfPCell cell = new PdfPCell () { Colspan = 6, VerticalAlignment = Element.ALIGN_MIDDLE };
cell.BackgroundColor = new Color(########);
chunk = new Chunk("Chunk");
cell.AddElement(chunk);
table.AddCell(cell);

but the text "Chunk" is still at the bottom of the cell. I can see empty space at the top of the cell.

Why won't my text align properly?

Upvotes: 1

Views: 169

Answers (1)

B. Krinsky
B. Krinsky

Reputation: 81

I switched the Chunks to Phrases, so now I'm in text mode, which allows the vertical alignment property.

PdfPCell cell = new PdfPCell (new Phrase("Chunk")) { Colspan = 6, VerticalAlignment = Element.ALIGN_MIDDLE };
cell.BackgroundColor = new Color(########);
table.AddCell(cell);

Upvotes: 1

Related Questions