SpreadJS 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.
This example searches for a specific text string.
JavaScript |
Copy Code
|
---|---|
activeSheet.getCell(2,3).value("testSearch"); var searchCondition = new GcSpread.Sheets.SearchCondition(); searchCondition.searchString = "testSearch"; searchCondition.startSheetIndex = spread.getActiveSheetIndex(); searchCondition.endSheetIndex = spread.getActiveSheetIndex(); searchCondition.searchOrder = GcSpread.Sheets.SearchOrder.NOrder; searchCondition.searchTarget = GcSpread.Sheets.SearchFoundFlags.CellText; searchCondition.searchFlags = GcSpread.Sheets.SearchFlags.Ignorecase| GcSpread.Sheets.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); |