开发者

Word Automation search in range

开发者 https://www.devze.com 2022-12-28 13:32 出处:网络
This is how I define the find object: Range rngDoc = m_oDocument.G开发者_高级运维etContent(); nEnd = rngDoc.GetEnd();

This is how I define the find object:

    Range rngDoc = m_oDocument.G开发者_高级运维etContent();
    nEnd = rngDoc.GetEnd();
    rngDoc.SetRange(nStart,nEnd);//do not search entire document -> faster
    Find fn = rngDoc.GetFind();

However, when I execute the Find, it finds objects that lay before the given start.

Any idea how do I define where the find should search?


Solved!

Problem was that the start of the Range was in a table cell and the end was the end of the document. For some reason, Find then searches entire cell, and not from the beginning of the range.

EDIT: It seems that problem occurs whenever there is a table in the range. Does anyone have a solution to this problem?

0

精彩评论

暂无评论...
验证码 换一张
取 消