跳到主要内容

GetRoleColor

返回指定角色的 RGB 颜色。

语法

expression.GetRoleColor(name);

expression - 表示 ApiFormRoles 类的变量。

参数

名称必需/可选数据类型默认值描述
name必需string角色名称。

返回值

null | Object

示例

检索文档中分配给角色的颜色。

// How do I find out what color a role uses in a document?

// Check the color value for a specific role in a document.

let doc = Api.GetDocument();
let roles = doc.GetFormRoles();
roles.Add("Customer");
let color = roles.GetRoleColor("Customer");
let paragraph = doc.GetElement(0);
paragraph.AddText("Role color: rgb(" + color.r + ", " + color.g + ", " + color.b + ")");