处理文件 -> Word 2007 中的新增功能

发布于 2024-08-03 17:22:26 字数 136 浏览 4 评论 0原文

我正在为 Word 2007 编写 VSTO 插件。当用户选择“文件”->“新建”(或从快速访问工具栏中选择它)时,我需要显示自定义表单而不是标准的新文档对话框。我该怎么做?我没有看到我可以处理的应用程序事件,而且我似乎也找不到添加事件处理程序的按钮。

I am writing a VSTO addin for Word 2007. When the user selects File->New, (or selects it from the quick access toolbar) I need to display a custom form instead of the standard new document dialog. How do I do this? I don't see an application event I can handle and I can't seem to find the buttont to add an event handler too.

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

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

发布评论

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

评论(1

阳光下的泡沫是彩色的 2024-08-10 17:22:26

好的,刚刚找到了。您需要创建一个 Ribbon xml,然后为这些按钮添加命令。在这种情况下,功能区 xml 是

<commands>
    <command idMso="FileNew" onAction="FileNewOverride"/>
    <command idMso="FileNewDefault" onAction="FileNewOverride"/>
</commands>

,后面的代码是

public void FileNewOverride(Office.IRibbonControl control, ref bool cancelDefault)
    {
        //do something
    }

MSDN 上的此操作方法向您展示了如何操作 http://msdn.microsoft.com/en-us/office/dd361753.aspx

Ok, just found it. You need to create a Ribbon xml and then add commands for those buttons. In this case the ribbon xml is

<commands>
    <command idMso="FileNew" onAction="FileNewOverride"/>
    <command idMso="FileNewDefault" onAction="FileNewOverride"/>
</commands>

and the code behind is

public void FileNewOverride(Office.IRibbonControl control, ref bool cancelDefault)
    {
        //do something
    }

This how-to on MSDN shows you how to do it http://msdn.microsoft.com/en-us/office/dd361753.aspx

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