Get Started
Documentation

SetCellSpacing

SetCellSpacing(nValuenullable)

Specify the default table cell spacing (the spacing between adjacent cells and the edges of the table).

Parameters:

Name Type Attributes Description
nValue twips <nullable>
Spacing value measured in twentieths of a point (1/1440 of an inch). "Null" means no spacing will be applied.

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oTable, oTableStyle, oCell, oTablePr;
oParagraph = oDocument.GetElement(0);
oParagraph.AddText("We create a 3x3 table and set the cell spacing to half an inch:");
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTablePr = oTableStyle.GetTablePr();
oTable = Api.CreateTable(3, 3);
oTable.SetStyle(oTableStyle);
oTablePr.SetCellSpacing(720);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetCellSpacing.docx");
builder.CloseFile();

Resulting document