跳到主要内容

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");