跳到主要内容

SetUserId

设置批注作者的用户 ID。

语法

expression.SetUserId(sUserId);

expression - 表示 ApiComment 类的变量。

参数

名称必需/可选数据类型默认值描述
sUserId必需string批注作者的用户 ID。

返回值

此方法不返回任何数据。

示例

此示例设置批注作者的用户 ID。

// How to change a comment author ID.

// Replace a comment author ID to a new one.

let worksheet = Api.GetActiveSheet();
worksheet.GetRange("A1").SetValue("1");
let range = worksheet.GetRange("A1");
let comment = range.AddComment("This is just a number.", "John Smith");
worksheet.GetRange("A3").SetValue("Comment's user Id: ");
comment.SetUserId("uid-2");
worksheet.GetRange("B3").SetValue(comment.GetUserId());