Search
在表格行对象的范围内搜索。搜索结果是 ApiRange 对象的集合。
语法
expression.Search(sText, isMatchCase);
expression - 表示 ApiTableRow 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| sText | 必需 | string | 搜索字符串。 | |
| isMatchCase | 必需 | boolean | 是否区分大小写。 |
返回值
ApiRange[]
示例
此示例展示如何在表格单元格中搜索。
// Search the word from the row.
// How to find a word from the row and make it bold.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetStyle(tableStyle);
let row = table.GetRow(0);
row.GetCell(0).GetContent().GetElement(0).AddText("text");
row.GetCell(1).GetContent().GetElement(0).AddText("text");
row.GetCell(2).GetContent().GetElement(0).AddText("text");
doc.Push(table);
let rowSearch = row.Search("tex", true);
rowSearch[1].SetBold("true");