跳到主要内容

SetBorders

使用指定的参数设置单元格/单元格范围的边框。

语法

expression.SetBorders(bordersIndex, lineStyle, oColor);

expression - 表示 ApiRange 类的变量。

参数

名称必需/可选数据类型默认值描述
bordersIndex必需BordersIndex指定单元格边框位置。
lineStyle必需LineStyle指定用于形成单元格边框的线条样式。
oColor必需ApiColor指定要设置给单元格边框的颜色的颜色对象。

返回值

此方法不返回任何数据。

示例

此示例使用指定的参数设置单元格的边框。

// How to set the thick bottom border to a cell.

// Get a range and set its border specifying its side, type and color.

let worksheet = Api.GetActiveSheet();
worksheet.SetColumnWidth(0, 50);
worksheet.GetRange("A2").SetBorders("Bottom", "Thick", Api.CreateColorFromRGB(255, 111, 61));
worksheet.GetRange("A2").SetValue("This is a cell with a bottom border");