跳到主要内容

SetScreenTipText

设置超链接的屏幕提示文本。

语法

expression.SetScreenTipText(sScreenTipText);

expression - 表示 ApiHyperlink 类的变量。

参数

名称必需/可选数据类型默认值描述
sScreenTipText必需string超链接的屏幕提示文本。

返回值

boolean

示例

此示例设置超链接的屏幕提示文本。

// How to specify the hyperlink screen tip text.

// Set the screen tip text of the link.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const fill = Api.CreateSolidFill(Api.HexColor('#456789'));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = Api.CreateShape('rect', 150 * 36000, 150 * 36000, fill, stroke);
page.AddObject(shape);

const docContent = shape.GetContent();
let paragraph = docContent.GetElement(0);

let run = Api.CreateRun();
run.AddText("ONLYOFFICE Document Builder");
paragraph.AddElement(run);
let hyperlink = paragraph.AddHyperlink("https://api.onlyoffice.com/docbuilder/basic");
hyperlink.SetScreenTipText("ONLYOFFICE for developers");
let screenTipText = hyperlink.GetScreenTipText();
paragraph = Api.CreateParagraph();
paragraph.AddText("Screen tip text: " + screenTipText);
docContent.Push(paragraph);