VSTO:Word 文档内容/文本更改事件?
有谁知道是否可以处理内容更改,或者更准确地说是否有一个事件......如果文档内容已更改(最好在什么位置/范围等),该事件会通知我?
Does anyone know whether it's possible to handle content changes or more precisely whether there's an event for that... one that would notify me if a document's content has been changed (ideally at what position/range etc)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这已经不可能了。在 Office 2007 及更低版本中,您可以使用智能标记并创建自定义智能标记,当内容更改时会回调该标记,但它们在 Office 2010 中被删除:(
我认为计时器是唯一的方法,不幸的是您会如果采用这种方法,必须确保您不会破坏单词的性能。
This is not possible anymore. In Office 2007 and below you could use smart tags and create a custom smart tag, which get called back into when content changes, but they were removed in Office 2010 :(
I think that a Timer is the only way to go, unfortunately you would have to make sure you did not kill performance of word if taking this approach..
该事件是“
Application.WindowSelectionChange
”,它将通知任何内容更改,但它不会通知位置/位置等更改 - 您将在您想要查找的内容中找到程序。The event is "
Application.WindowSelectionChange
" that will notify of any content changes, but it doesn't notify of what changed like location/position - you'll have program in what you want to look for.