//根据关键字返回关键字在文档中的位置集合 private List<DocumentRange> getDocumentRangeCollectionByKeyWord(string keyWord, Document searchDocument) { List<DocumentRange> documentRangeCollection = new List<DocumentRange>(); try { if (keyWord != "" && searchDocument != null) { //搜索参数设置 SearchOptions sOptions = SearchOptions.None; SearchDirection sDirection = SearchDirection.Forward; DocumentRange sRange = searchDocument.Range; //开始搜索 ISearchResult _SearchResult = searchDocument.StartSearch(keyWord, sOptions, sDirection, sRange); this.documentRangeCollection.Clear(); while (_SearchResult.FindNext()) documentRangeCollection.Add(_SearchResult.CurrentResult); } return documentRangeCollection; } catch { return documentRangeCollection; } }