MS Word插件,添加右键单击所选文本时弹出的按钮
我正在为 MS Word 2007 开发一个共享插件。我想添加一个在右键单击所选文本时弹出的按钮。 随附的快照应该可以清楚地说明这一点。
目前,用户必须选择文本,然后单击自定义控件上的按钮。 如果选择文本后,他/她可以右键单击它并按弹出窗口中的相关按钮,那就容易多了。
I am working on a shared addin for MS Word 2007. I would like to add a button which pops up when selected text is right clicked. The attached snapshot should make this clear.
Currently, the user has to select the text and then click a button on a custom control. It would be a lot easier if after selecting the text, s/he could right click it and press the relevant button in the popup.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您需要扩展正确的上下文菜单。 以下链接用文字(无源代码)描述了如何实现这一点:
使用 Word 的共享插件
也许这个 链接可能会对编码有所帮助。 我自己还没有尝试过,但它可能指向正确的方向。
祝你好运! :)
编辑:
它必须是功能区样式上下文菜单还是普通上下文菜单中的按钮就足够了?
如果普通菜单没问题,您可以使用这种方式(C#):
您可以使用 VSTO 来做到这一点,我不太确定它是否与共享插件技术的工作方式完全相同,但也许确实如此帮助 ;)
You need to extend the correct contextmenu. The following link describes in words (no source code) how this can be achieved:
Shared Addin using Word
Maybe this Link might help a little with the coding. I haven't tried it out myself, but it might point into the right direction.
Good luck! :)
Edit:
Does it have to be the ribbon style context menu or would a button within the normal context menu be enough?
In case the normal menu would be ok, you might use this way (C#):
You can do this with VSTO, I'm not so sure if it works exactly the same way with the shared Add-In technology, but maybe it does help ;)
来自 MSDN -
医生的一半多一点。 在迷你工具栏上搜索。
编辑:
上图中圈出的弹出窗口不会出现在右键单击时,而是出现在突出显示时。 上下文菜单(位于所选文本下方)可以具有您的自定义功能,但不在迷你工具栏中。
From MSDN -
a little over halfway down the doc. Search on mini toolbar.
Edit:
The popup you have circled in the image above doesn't appear on right-click, it appears on highlight. The context menu (below the selected text) could have your custom functionality, but not in the mini toolbar.
以下是如何做到这一点......
Here is how this can be done...
http://groups.google.com/group/microsoft.public.word.docmanagement/browse_thread/thread/cf55d996b3f51a06/65b2bad22e2a3583?lnk=st&q=Removing+Items+from+Word+2007< /a> 是如何在 VBA 中执行此操作。 它与使用 COM 非常相似,并且可能创建一个单词加载项(虽然我还没有尝试过),您基本上需要找到上下文菜单控件并向其添加一个项目(您的函数)。
http://groups.google.com/group/microsoft.public.word.docmanagement/browse_thread/thread/cf55d996b3f51a06/65b2bad22e2a3583?lnk=st&q=Removing+Items+from+Word+2007 is how to do it in VBA. It is very similar using COM and probably creating a word add-in (I have not tried it though) You basically need to find the context menu control and add an item to it (your function).