locked
Strange bevahior in Find.Execute RRS feed

  • Question

  • I have simple method in C# which use Find.Execute
    for a paragraph but the the result confuse me a lot.
    This is how i use it:

    private void Test(Word.Paragraph paragraph)
    {
       var start = paragraph.Range.Start;
       var end = paragraph.Range.End;
       
       object search = "又は";
       paragraph.Range.Find.Execute(ref search
                                MatchCase: false,
                                Forward: true,
                                MatchSoundsLike: false,
                                MatchAllWordForms: false,
                                Wrap: Word.WdFindWrap.wdFindStop);
    }

    The paragraph start is 10178 and end is 10236
    The text looks as follows:
    "(00)    役員又は経営に..."

    The search term "又は" here is at 7th position (10185) but Find.Execute returns 9735 which is true, there is a "又は" text here but its totaly below out of the paragraph's range. How can this be?

    Thanks in advance
    Sunday, November 8, 2020 4:22 AM