Spread.Sheets Documentation
Searching Data
Spread.Sheets Documentation > Developer's Guide > Managing Data > Searching Data

You can search for a string in the widget and specify options such as the case, exact match, wild cards, cell range to search, and the order to search in. You can search cell text, cell tags, or formulas.

You can use the search method and the SearchCondition class to find items in code.

Using Code

This example searches for a specific text string.

JavaScript
Copy Code

activeSheet.getCell(2,3).value("testSearch");
var searchCondition = new GC.Spread.Sheets.Search.SearchCondition();
searchCondition.searchString = "testSearch";
searchCondition.startSheetIndex = spread.getActiveSheetIndex();
searchCondition.endSheetIndex = spread.getActiveSheetIndex();

searchCondition.searchOrder = GC.Spread.Sheets.Search.SearchOrder.NOrder;
searchCondition.searchTarget = GC.Spread.Sheets.Search.SearchFoundFlags.CellText;
searchCondition.searchFlags = GC.Spread.Sheets.Search.SearchFlags.Ignorecase| GC.Spread.Sheets.Search.SearchFlags.UseWildCards;
var searchresult= spread.search(searchCondition);

var str ="[searchFoundFlag:"+ searchresult.searchFoundFlag+",\r\n foundSheetIndex:"+searchresult.foundSheetIndex+",foundRowIndex:" +
searchresult.foundRowIndex+", foundColumnIndex:"+searchresult.foundColumnIndex+", foundString:"+searchresult.foundSheetIndex+"]";
alert(str);