跳到主要内容

SetPaddings

设置表格内边距。 如果表格是内联的,则仅应用左内边距。

语法

expression.SetPaddings(nLeft, nTop, nRight, nBottom);

expression - 表示 ApiTable 类的变量。

参数

名称必需/可选数据类型默认值描述
nLeft必需Number左内边距。
nTop必需Number上内边距。
nRight必需Number右内边距。
nBottom必需Number下内边距。

返回值

boolean

示例

此示例设置表格内边距。

// How to set paddings of the table.

// Create a table and specify its paddings.

let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetStyle(tableStyle);
doc.Push(table);
table.GetCell(0, 0).GetContent().GetElement(0).AddText("This is just a sample text.");
table.SetPaddings(10, 10, 5, 5);