We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

I want the image more centered and and the text more on the right side.

At the moment my source code looks kind of this:

//Part 0 - Init
IWParagraph footerPar = new WParagraph(doc);
IWTable tablefooterPar = section.HeadersfooterPars.footerPar.AddTable();
RowFormat formatfooterPar = new RowFormat();

formatfooterPar.Borders.BorderType = BorderStyle.Single;

tablefooterPar.ResetCells(1, 2);

//Part 1 - Cell 1
footerPar = tablefooterPar[0, 0].AddParagraph() as WParagraph;
WPicture picturefooterPar = (WPicture)footerPar.AppendPicture(Image.FromFile(Path.Combine("...", "....png")));
picturefooterPar.VerticalAlignment = ShapeVerticalAlignment.Bottom;

(footerPar.Items[0] as WPicture).Width = 180.5f;
(footerPar.Items[0] as WPicture).Height = 25.75f;

 //tablefooterPar[0, 0].Width = 380;
//Part 2 - Cell 2
footerPar = tablefooterPar[0, 1].AddParagraph() as WParagraph;
IWTextRange txtfooterPar = footerPar.AppendText("some textsome textsome textsome textsome textsome textsome text");
txtfooterPar.CharacterFormat.FontSize = 15;

tablefooterPar.TableFormat.HorizontalAlignment = RowAlignment.Center;
footerPar.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Left;

(tablefooterPar[0, 1] as WTableCell).CellFormat.VerticalAlignment = VerticalAlignment.Top;

I want the image more centered and  and the text more on the right side.

My requirements are:
- the text shall still have the alignment left
- I want  the entire cell to be moved more to the right
- the table shall use the entire width

I tried using something like this "tablefooterPar[0, 0].Width = 380;", but this changed also the entire table.

Maybe you can give me another solution ?

3 Replies

SY Sethumanikkam Yogendran Syncfusion Team October 17, 2016 09:16 AM UTC

Hi Customer,

Thank you for using Syncfusion products.

On further analysing with the given details we suspect anyone of the following is your requirement.

1. Create a new table with 1 row and 2 cells. In first cell, inserted image should align in centre of the cell. In second cell, appended paragraph text should align in right of the cell.
2. Table width should have equivalent to width of the page.

Kindly provide your confirmation on the mentioned cases, thereby we will analyse further and will provided you appropriate solution.

For more details kindly refer following UG Link:

If we misunderstand your requirement then, kindly provide us Input document used (if any) and screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution


TH Thomas July 6, 2023 02:55 PM UTC

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.

AN Anto Nihil Sahaya Raj Syncfusion Team July 7, 2023 09:24 AM UTC

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.



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,

Please refer to our below UG documentation to know more about how to work with the table in the Word document,

Refer to our below UG documentation to know more about how to work with images in the Word document,

Anto Nihil S

Live Chat Icon For mobile
Up arrow icon