Skip to main content

SetJc

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

Syntax

expression.SetJc(sJcType);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sJcTypeRequired"left" | "right" | "center"The alignment type used for the current table placement.

Returns

boolean

Example

This example specifies the alignment of the table with respect to the text margins in the current section.

// How to set justification of the paragraph content.

// Change the justification of the paragraph.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("The table is aligned at the center of the page horizontally:");
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let tablePr = tableStyle.GetTablePr();
tablePr.SetJc("center");
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 50);
table.SetTableLook(true, true, true, true, false, false);
table.SetStyle(tableStyle);
doc.Push(table);