跳到主要内容

SetTableBorderAll

指定将在所有表格单元格边框上显示的边框。

继承自 ApiTablePr.SetTableBorderAll。

语法​

expression.SetTableBorderAll(type, size, space, color);

expression - 表示 ApiTable 类的变量。

参数​

名称必需/可选数据类型默认值描述
type必需BorderType边框样式。
size必需pt_8当前边框的宽度,以磅的八分之一为单位。
space必需pt用于放置此边框的表格单元格间距偏移量,以磅为单位。
color必需ApiColor边框颜色。

返回值​

boolean

示例​

在文档中为表格的四周和内部添加统一边框。

// How do I apply the same border style to every edge of a table in a document?

// Give a table a consistent outline and interior grid by setting all borders at once in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("We create a 3x3 table and add 4 point black border for the entrire table:");
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetTableBorderAll("single", 32, 0, Api.Color(51, 51, 51));
doc.Push(table);