Exemplo n.º 1
0
        private List <Range> GetFoundRanges(SearchWordsForm statusForm, Document document, List <string> words)
        {
            List <Range> foundRanges = new List <Word.Range>();
            Range        range;
            int          i = 0;

            foreach (string word in words)
            {
                i++;
                statusForm.PercentageLabel.Text = string.Format("{0}%", (int)(100.0 * ((double)i) / words.Count));
                statusForm.SearchForLabel.Text  = word;
                statusForm.Update();

                range = document.Content;
                range.Find.Forward        = true;
                range.Find.Wrap           = Word.WdFindWrap.wdFindStop;
                range.Find.Text           = word;
                range.Find.MatchWholeWord = !partCheckBox.Checked;

                while (range.Find.Execute())
                {
                    foundRanges.Add(range.Duplicate);
                }
            }

            return(foundRanges);
        }