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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to set margins of table cell?

Thread ID:





93409 Mar 11,2010 06:39 PM UTC Mar 15,2010 07:11 PM UTC WinForms 1
Tags: DocIO
Andreas Hirtzel
Asked On March 11, 2010 06:39 PM UTC


how can I set the margins of a table cell? (See screenshot)



Vijayakumar S [Syncfusion]
Replied On March 15, 2010 07:11 PM UTC

Hi Adi,

Thank you for using Syncfusion products.

Please do find the code snippet to set the cell margin for a table/table cell.

WordDocument wordDoc = new WordDocument();
IWTable table = wordDoc.LastSection.AddTable();
RowFormat format = new RowFormat();

//This line sets cell margin for all the cells as 4f (for left, right, top and bottom margins)
format.Paddings.All = 4f;

table.ResetCells(2, 2, format, 200);

for (int rowIndex = 0; rowIndex < 2; rowIndex++)
for (int colIndex = 0; colIndex < 2; colIndex++)
WTableCell cell = table.Rows[rowIndex].Cells[colIndex];
//This line Defines whether to use same paddings as table has.
cell.CellFormat.SamePaddingsAsTable = false;

cell.CellFormat.Paddings.Left = 5.4f; //in terms of points
cell.CellFormat.Paddings.Right = 5.4f;//in terms of points
cell.CellFormat.Paddings.Top = 0;//in terms of points
cell.CellFormat.Paddings.Bottom = 0;//in terms of points

Please let us know if you have any questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon