跳到主要内容

SetTableBorderTop

设置将在当前表格顶部显示的边框。

语法​

expression.SetTableBorderTop(type, size, fill);

expression - 表示 ApiTablePr 类的变量。

参数​

名称必需/可选数据类型默认值描述
type必需BorderType顶部边框样式。
size必需mm当前上边框的宽度。
fill必需ApiFill用于填充当前边框的颜色或图案。

返回值​

boolean

示例​

在演示文稿中通过表格属性设置表格上边框。

// The border width is measured in millimeters and the color is passed as an ApiFill object.

// Apply a dark gray border above the table.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);
const table = Api.CreateTable(3, 3);
const style = presentation.GetStyle("No Style, Table Grid");
table.SetStyle(style);
const tablePr = style.GetTablePr();
tablePr.SetTableBorderTop("single", 1, Api.CreateSolidFill(Api.RGB(51, 51, 51)));
style.SetTablePr(tablePr);
slide.RemoveAllObjects();
slide.AddObject(table);