GetRange
返回表示指定表格中所包含文档部分的 Range 对象。
语法
expression.GetRange(Start, End);
expression - 表示 ApiTable 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| Start | 必需 | Number | 当前元素中的起始位置索引。 | |
| End | 必需 | Number | 当前元素中的结束位置索引。 |
返回值
示例
此示例展示如何获取表示指定表格中所包含文档部分的 Range 对象。
// How to get a range object using an address.
// Update a rabge knowing its cell address.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
table.SetStyle(tableStyle);
doc.Push(table);
table.GetCell(0, 0).GetContent().GetElement(0).AddText("This is just a sample text.");
let range = table.GetRange(0, 3);
range.SetBold(true);