Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put an image in the center of a cell with migradoc

I need to put an image in the center of a table's cell. When I add the image in a cell the image is aligned topleft. How can I align the image in the center of a cell?

like image 251
Martina Avatar asked Oct 13 '14 16:10

Martina


2 Answers

You might need to add a paragraph to the cell, set the alignment on the paragraph, and then add the image to the paragraph.

row.Cells[0].Format.Alignment = ParagraphAlignment.Center;
row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
row.Cells[0].AddParagraph().AddImage(imageLocation);
like image 89
Reuben Avatar answered Nov 15 '22 04:11

Reuben


row.Cells[0].Format.Alignment = ParagraphAlignment.Center;
row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
like image 20
Jeff Avatar answered Nov 15 '22 04:11

Jeff