What you guys suggested is exactly what I'm trying to do. How do I achieve it?
I have a table and need to center the images in said table's cells, with even multiple images in a single cell.
Hi Thomas,
From the given details, we have found that your requirement is to align an
image in the center of a table cell. To achieve your requirement, we suggested
you to set vertical alignment as Middle to VerticalAlignment
API of the table cell and set horizontal alignment as Center to the HorizontalAlignment
API of the paragraph. Please refer to the below-highlighted code snippet.
WTableCell cell = table[0, 1]; //Specifies the vertical alignment of content of text. cell.CellFormat.VerticalAlignment = VerticalAlignment.Middle; //Add paragraph to the table cell. paragraph = cell.AddParagraph(); //Set horizantal alignment of the paragraph. paragraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center; //Append picture to the paragraph. paragraph.AppendPicture(Image.FromFile(Path.GetFullPath(@"../../Images/Image1.jpg")));
|
We have prepared a sample
application that demonstrates even when multiple images are present within a
single cell how to align those images in the center of a table cell. It can be
downloaded from the below,
https://www.syncfusion.com/downloads/support/directtrac/general/ze/Align-image-in-table847705134.zip
Please refer to our below UG documentation to know more about how to work with
the table in the Word document,
https://help.syncfusion.com/file-formats/docio/working-with-tables
Refer to our below UG documentation to know more about how to work with images
in the Word document,
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#working-with-images
Regards,
Anto Nihil S