TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

SetCellSpacing

SetCellSpacing(nValue)

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

Parameters:

Name Type Description
nValue twips

Spacing value measured in twentieths of a point (1/1440 of an inch). "Null" means that no spacing will be applied.

Returns:

This method doesn't return any data.

Example

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

Resulting document