跳到主要内容

Search

Searches for a scope of a table object. The search results are a collection of ApiRange objects.

Syntax

expression.Search(sText, isMatchCase);

expression - A variable that represents a ApiTable class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTextRequiredstringSearch string.
isMatchCaseRequiredbooleanCase sensitive or not.

Returns

ApiRange[]

Example

This example shows how to make search in table.

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);
table.GetCell(0, 0).GetContent().GetElement(0).AddText("Cell 1");
table.GetCell(0, 1).GetContent().GetElement(0).AddText("Cell 2");
table.GetCell(0, 2).GetContent().GetElement(0).AddText("Cell 3");
doc.Push(table);
let searchResults = table.Search("Cell");
searchResults[0].SetBold(true);