We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Horizontally center an image in a cell


I am not finding a way to vertically align an image in a cell in Aspose.Words. Is there a way to do this?



Hi Chris,

Thanks for your inquiry. Please use CellFormat.VerticalAlignment property to set the vertical alignment of text/image in the cell.

Document doc = new Document(MyDir + @"in.docx"); 
Table table = doc.FirstSection.Body.Tables[0];
Row row = table.LastRow;
row.LastCell.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
doc.Save(MyDir + @"17.1.0.docx");

Hope, this helps.

Best regards,


Thanks. I also found a way to do this through the paragraph object. I just hadn’t had time to update my ticket on Friday after the discovery.

Thanks again for your time.

Hi Chris,

It is great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,