GetRange
返回表示指定超链接中所包含文档部分的 Range 对象。
语法
expression.GetRange(Start, End);
expression - 表示 ApiHyperlink 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| Start | 必需 | Number | 当前元素中的起始位置索引。 | |
| End | 必需 | Number | 当前元素中的结束位置索引。 |
返回值
示例
此示例展示如何获取表示指定超链接中所包含文档部分的 Range 对象。
// Get the range where the hyperlink is located.
// Make the hyperlink range bold.
let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("Api Document Builder");
let hyperlink = paragraph.AddHyperlink("https://api.onlyoffice.com/docbuilder/basic");
let range = hyperlink.GetRange(0, 2);
range.SetBold(true);