处理文件-> 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屋!