Word Automation 在范围内搜索
这就是我定义查找对象的方式:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了!
问题是范围的开头位于表格单元格中,结尾是文档的结尾。由于某种原因,“查找”会搜索整个单元格,而不是从范围的开头开始。
编辑:似乎只要范围内有一个表就会出现问题。有人有解决这个问题的办法吗?
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?