Word Automation 在范围内搜索

发布于 2024-08-31 12:47:40 字数 288 浏览 4 评论 0原文

这就是我定义查找对象的方式:

    Range rngDoc = m_oDocument.GetContent();
    nEnd = rngDoc.GetEnd();
    rngDoc.SetRange(nStart,nEnd);//do not search entire document -> faster
    Find fn = rngDoc.GetFind();

但是,当我执行查找时,它会查找位于给定开始之前的对象。
知道如何定义查找应该搜索的位置吗?

This is how I define the find object:

    Range rngDoc = m_oDocument.GetContent();
    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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉宸 2024-09-07 12:47:40

解决了!

问题是范围的开头位于表格单元格中,结尾是文档的结尾。由于某种原因,“查找”会搜索整个单元格,而不是从范围的开头开始。

编辑:似乎只要范围内有一个表就会出现问题。有人有解决这个问题的办法吗?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文