TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

SetJc

SetJc(sJcType)

Specifies the alignment of the current table with respect to the text margins in the current section.

Parameters:

Name Type Description
sJcType "left" | "right" | "center"

The alignment type used for the current table placement.

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("The table is aligned at the center of the page horizontally:");
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTablePr = oTableStyle.GetTablePr();
oTablePr.SetJc("center");
var oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 50);
oTable.SetTableLook(true, true, true, true, false, false);
oTable.SetStyle(oTableStyle);
oDocument.Push(oTable);
builder.SaveFile("docx", "SetJc.docx");
builder.CloseFile();

Resulting document