- const wb = workbook;
- const sheets = wb.sheets;
- let currentSheetIdx = 0;
- const res = [];
-
- const searchCondition = new GC.Spread.Sheets.Search.SearchCondition();
- searchCondition.searchString = 16;
- searchCondition.searchFlags=GC.Spread.Sheets.Search.SearchFlags.ignoreCase | GC.Spread.Sheets.Search.SearchFlags.useWildCards;
- searchCondition.searchTarget = GC.Spread.Sheets.Search.SearchFoundFlags.cellText;
- while (currentSheetIdx < sheets.length) {
- const searchResult = wb.search(searchCondition);
- if (
- !searchResult ||
- searchResult.searchFoundFlag === GC.Spread.Sheets.Search.SearchFoundFlags.none
- ) {
- searchCondition.columnStart = 0;
- searchCondition.rowStart = 0;
- searchCondition.startSheetIndex = currentSheetIdx + 1;
- currentSheetIdx += 1;
- } else {
- res.push(searchResult);
-
- searchCondition.columnStart = searchResult.foundColumnIndex + 1;
- searchCondition.rowStart = searchResult.foundRowIndex;
- currentSheetIdx = searchResult.foundSheetIndex;
- }
- }
- console.log(res)
复制代码 以上是参考demo写的搜索,使用附件的sheet5的数据是sheet2、sheet3的并集,搜索比如16,sheet2,sheet3的数据搜索不出来,但是sheet5的数据能搜索
|
|