处理文件 -> Word 2007 中的新增功能 [英] Handle File->New in Word 2007
问题描述
我正在为 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.
推荐答案
好的,刚找到.您需要创建一个 Ribbon xml,然后为这些按钮添加命令.在这种情况下,功能区 xml 是
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>
后面的代码是
public void FileNewOverride(Office.IRibbonControl control, ref bool cancelDefault)
{
//do something
}
MSDN 上的此操作方法向您展示了如何操作 http://msdn.microsoft.com/en-us/office/dd361753.aspx
This how-to on MSDN shows you how to do it http://msdn.microsoft.com/en-us/office/dd361753.aspx
这篇关于处理文件 -> Word 2007 中的新增功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!