Ribbon1: 在Office菜单中添加项目
Office菜单使用下面的XML标记:
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#808080; font-style:italic"><!--</span>
- <span style="color:#808080; font-style:italic"> Everything else goes here</span>
- <span style="color:#808080; font-style:italic"> --></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
下表列出了Office菜单的子元素。
对象 | 用来做什么 |
---|---|
control | 引用通用控件对象,能够表现其它对象例如按钮、拆分按钮、组,等 |
button | 引用通过正常的单击就能执行某类操作的按钮控件 checkbox 引用复选框控件 |
gallery | 引用库控件 |
toggleButton | 引用切换按钮,在True/False值之间切换 |
menuSeparator | 引用菜单分隔条项 |
splitButton | 引用能够用于容纳其它控件例如按钮控件的拆分按钮 |
menu | 引用能够用于容纳其它控件例如按钮控件的菜单控件 |
dynamicMenu | 引用动态菜单,能够在运行时接受动态的XML内容 |
下图为定制Excel中Office菜单的一个示例。在Office菜单中添加了一个拆分按钮My Tools,包含两个组My Toolset1和My Toolset2。
在这个示例中,我们创建了包含菜单(根据特定任务组织的几个按钮)的拆分按钮,XML代码如下:
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><customUI</span> <span style="color:#000066">xmlns</span>=<span style="color:#ff0000">"http://schemas.microsoft.com/office/2006/01/customui"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><ribbon</span> <span style="color:#000066">startFromScratch</span>=<span style="color:#ff0000">"false"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><splitButton</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsbtn"</span></span>
- <span style="color:#009900"> <span style="color:#000066">insertBeforeMso</span>=<span style="color:#ff0000">"FilePrintMenu"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnSplitMain"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"My Tools"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"CreateModule"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menu</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxmnu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">itemSize</span>=<span style="color:#ff0000">"large"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep1"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 1"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSheet"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FileSendAsAttachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail sheet as attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail the active sheet as an attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSupport"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"MessageToAttendeesMenu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail technical support"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about issues on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailBug"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"ResearchPane"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail a bug"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about bugs found on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep2"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 2"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnPrintPDF"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FilePrint"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"Print to PDF"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"Print active sheet to PDF file format"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></menu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></splitButton<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></ribbon<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></customUI<span style="color:#000000; font-weight:bold">></span></span></span>
实际上,菜单控件也可以提供相同的定制而不须像拆分按钮那样的中间步骤,例如上例可以修改如下:
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><customUI</span> <span style="color:#000066">xmlns</span>=<span style="color:#ff0000">"http://schemas.microsoft.com/office/2006/01/customui"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><ribbon</span> <span style="color:#000066">startFromScratch</span>=<span style="color:#ff0000">"false"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menu</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxmnu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">insertBeforeMso</span>=<span style="color:#ff0000">"FilePrintMenu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"My Tools"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"CreateModule"</span></span>
- <span style="color:#009900"> <span style="color:#000066">itemSize</span>=<span style="color:#ff0000">"large"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep1"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 1"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSheet"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FileSendAsAttachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail sheet as attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail the active sheet as an attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSupport"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"MessageToAttendeesMenu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail technical support"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about issues on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailBug"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"ResearchPane"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail a bug"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about bugs found on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep2"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 2"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnPrintPDF"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FilePrint"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"Print to PDF"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"Print active sheet to PDF file format"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></menu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></ribbon<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></customUI<span style="color:#000000; font-weight:bold">></span></span></span>
结果如下图所示:
可以看出,实现的效果并没有太大的差异。如果认真观察,就会发现拆分按钮在箭头和按扭之间有一条分隔线,而菜单则没有。
上面的示例是在Office菜单中添加自已自定义的项目,当然也可以在Office菜单里的内置元素中添加自定义项目或内置项目,此时您需要知道在什么元素中放置项目,下表列出了Office菜单元素。
表:Office菜单元素
元素 | 类型 | IDMSO | 应用于 |
---|---|---|---|
新建 | 按钮 | FileMenu | Excel/Access/Word |
打开 | 按钮 | FileOpen | Excel/Word |
打开 | 按钮 | FileOpenDatabase | Access |
保存 | 按钮 | FileSave | Excel/Word/Access |
另存为 | 拆分按钮 | FileSaveAsMenu | Excel/Word |
另存为 | 拆分按钮 | FileSaveAsMenuAccess | Access |
打印 | 拆分按钮 | FilePrintMenu | Excel/Word/Access |
准备 | 菜单 | FilePrepareMenu | Excel/Word |
管理 | 菜单 | FileManageMenu | Access |
发送 | 菜单 | FileSendMenu | Excel/Word |
电子邮件 | 按钮 | FileSendAsAttachment | Access |
发布 | 菜单 | MenuPublish | Excel/Word/Access |
关闭 | 按钮 | FileClose | Excel/Word |
关闭数据库 | 按钮 | FileCloseDatabase | Access |
Office菜单使用下面的XML标记:
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#808080; font-style:italic"><!--</span>
- <span style="color:#808080; font-style:italic"> Everything else goes here</span>
- <span style="color:#808080; font-style:italic"> --></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
下表列出了Office菜单的子元素。
对象 | 用来做什么 |
---|---|
control | 引用通用控件对象,能够表现其它对象例如按钮、拆分按钮、组,等 |
button | 引用通过正常的单击就能执行某类操作的按钮控件 checkbox 引用复选框控件 |
gallery | 引用库控件 |
toggleButton | 引用切换按钮,在True/False值之间切换 |
menuSeparator | 引用菜单分隔条项 |
splitButton | 引用能够用于容纳其它控件例如按钮控件的拆分按钮 |
menu | 引用能够用于容纳其它控件例如按钮控件的菜单控件 |
dynamicMenu | 引用动态菜单,能够在运行时接受动态的XML内容 |
下图为定制Excel中Office菜单的一个示例。在Office菜单中添加了一个拆分按钮My Tools,包含两个组My Toolset1和My Toolset2。
在这个示例中,我们创建了包含菜单(根据特定任务组织的几个按钮)的拆分按钮,XML代码如下:
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><customUI</span> <span style="color:#000066">xmlns</span>=<span style="color:#ff0000">"http://schemas.microsoft.com/office/2006/01/customui"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><ribbon</span> <span style="color:#000066">startFromScratch</span>=<span style="color:#ff0000">"false"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><splitButton</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsbtn"</span></span>
- <span style="color:#009900"> <span style="color:#000066">insertBeforeMso</span>=<span style="color:#ff0000">"FilePrintMenu"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnSplitMain"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"My Tools"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"CreateModule"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menu</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxmnu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">itemSize</span>=<span style="color:#ff0000">"large"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep1"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 1"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSheet"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FileSendAsAttachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail sheet as attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail the active sheet as an attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSupport"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"MessageToAttendeesMenu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail technical support"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about issues on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailBug"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"ResearchPane"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail a bug"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about bugs found on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep2"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 2"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnPrintPDF"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FilePrint"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"Print to PDF"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"Print active sheet to PDF file format"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></menu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></splitButton<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></ribbon<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></customUI<span style="color:#000000; font-weight:bold">></span></span></span>
实际上,菜单控件也可以提供相同的定制而不须像拆分按钮那样的中间步骤,例如上例可以修改如下:
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><customUI</span> <span style="color:#000066">xmlns</span>=<span style="color:#ff0000">"http://schemas.microsoft.com/office/2006/01/customui"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><ribbon</span> <span style="color:#000066">startFromScratch</span>=<span style="color:#ff0000">"false"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menu</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxmnu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">insertBeforeMso</span>=<span style="color:#ff0000">"FilePrintMenu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"My Tools"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"CreateModule"</span></span>
- <span style="color:#009900"> <span style="color:#000066">itemSize</span>=<span style="color:#ff0000">"large"</span><span style="color:#000000; font-weight:bold">></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep1"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 1"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSheet"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FileSendAsAttachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail sheet as attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail the active sheet as an attachment"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailSupport"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"MessageToAttendeesMenu"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail technical support"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about issues on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnEmailBug"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"ResearchPane"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"E-mail a bug"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"E-mail technical support about bugs found on this application..."</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><menuSeparator</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxsep2"</span></span>
- <span style="color:#009900"> <span style="color:#000066">title</span>=<span style="color:#ff0000">"My Toolset 2"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"><button</span></span>
- <span style="color:#009900"> <span style="color:#000066">id</span>=<span style="color:#ff0000">"rxbtnPrintPDF"</span></span>
- <span style="color:#009900"> <span style="color:#000066">imageMso</span>=<span style="color:#ff0000">"FilePrint"</span></span>
- <span style="color:#009900"> <span style="color:#000066">label</span>=<span style="color:#ff0000">"Print to PDF"</span> </span>
- <span style="color:#009900"> <span style="color:#000066">description</span>=<span style="color:#ff0000">"Print active sheet to PDF file format"</span></span>
- <span style="color:#009900"> <span style="color:#000066">onAction</span>=<span style="color:#ff0000">"rxshared_click"</span><span style="color:#000000; font-weight:bold">/></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></menu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></officeMenu<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></ribbon<span style="color:#000000; font-weight:bold">></span></span></span>
- <span style="color:#009900"><span style="color:#000000; font-weight:bold"></customUI<span style="color:#000000; font-weight:bold">></span></span></span>
结果如下图所示:
可以看出,实现的效果并没有太大的差异。如果认真观察,就会发现拆分按钮在箭头和按扭之间有一条分隔线,而菜单则没有。
上面的示例是在Office菜单中添加自已自定义的项目,当然也可以在Office菜单里的内置元素中添加自定义项目或内置项目,此时您需要知道在什么元素中放置项目,下表列出了Office菜单元素。
表:Office菜单元素
FileNew 是新建。下面的FileMenu是文件那个按钮
元素 | 类型 | IDMSO | 应用于 |
---|---|---|---|
新建 | 按钮 | FileMenu | Excel/Access/Word |
打开 | 按钮 | FileOpen | Excel/Word |
打开 | 按钮 | FileOpenDatabase | Access |
保存 | 按钮 | FileSave | Excel/Word/Access |
另存为 | 拆分按钮 | FileSaveAsMenu | Excel/Word |
另存为 | 拆分按钮 | FileSaveAsMenuAccess | Access |
打印 | 拆分按钮 | FilePrintMenu | Excel/Word/Access |
准备 | 菜单 | FilePrepareMenu | Excel/Word |
管理 | 菜单 | FileManageMenu | Access |
发送 | 菜单 | FileSendMenu | Excel/Word |
电子邮件 | 按钮 | FileSendAsAttachment | Access |
发布 | 菜单 | MenuPublish | Excel/Word/Access |
关闭 | 按钮 | FileClose | Excel/Word |
关闭数据库 | 按钮 | FileCloseDatabase | Access |
Ribbon1: 在Office菜单中添加项目的更多相关文章
- python实现应用程序在右键菜单中添加打开方式
最近项目组开发的一个小工具想要在右键菜单中添加打开方式,以有道云笔记为例进行了需求拆解和代码编写 1.需求拆解: 如何实现手动添加右键菜单的打开方式: Step1:打开注册表编辑器,Win+R-> ...
- 在右键菜单中添加用Jupyter Notebook打开
在右键菜单中添加用Jupyter Notebook打开 为了把 Jupyter 的工作目录指定到某一个文件夹下,每次都要启动 CMD 终端, 然后激活 Anaconda 环境,再启动 Jupyter ...
- window 右键菜单中添加在vs code 打开
原文链接: window 右键菜单中添加在vs code 打开 window 右键菜单中添加在vs code 打开 吃码小妖:以前安装VS code可以的,后面不知道为什么不能右键在VS code中打 ...
- JCEF 如何修改右键菜单项(JCEF在右键菜单中添加开发者选项-show dev tools)
需求: 在界面的右键事件中添加一个打开开发者选项的菜单(Show Dev Tools) 所以我们可以看到的是在界面上右键,会有默认的一些菜单项(前进,后退,打印,查看源码),而这些功能并不一定是我们需 ...
- VS2010在空解决方案中添加项目
如题,在空解决方案中添加第一个项目的时候会看不到那个solution解决方案文件,而是你当前添加的项目,当你再添加其他项目的时候就悲催了,找不到这个solution,只能在这个项目文件上新加文件,很郁 ...
- 使用git向github中添加项目并更新(备忘录)
今天使用Git&github&ST3时,发现ST3不仅是git插件不能push成功,使用sublimegit插件也不行. 可能是没有掌握sublimegit的使用技巧,有待后续继续摸索 ...
- 在Eclipse新建菜单中添加JSP
在开发的时候,大家可能选择不同的透视图,下面以Java EE透视图为例. 在项目上右键,选择new命令,出来的菜单中并没有新建JSP的选项. 这样一来,如果想新建JSP,只能选择Other命令,在里面 ...
- mfc 小程序---在系统菜单中添加菜单项
1建立一个对话框工程:在dlg类里定义一个菜单指针m_pMenu,在对话框OnInitDialog函数里添加代码: m_pMenu=GetSystemMenu(FALSE);//获取系统菜单的指针 m ...
- eclipse 本地项目提交到远程库以及从远程库中添加项目 ---git
本地项目提交到远程库 1.右击项目->team->share project 2.选择本地库 从远处库中的项目拉到本地 1.右击项目->import项目
随机推荐
- Android学习笔记--远程服务的使用
1.AIDL和Binder Android系统四大组件Activity, Content Provider, Broadcast和Service均可以进行跨进程数据传输. Activity可以隐式调用 ...
- Ext tpl 造成 store不能正确加载
最近维护别人写的代码的时候,遇到了这么个情况 找原因找到了这行代码的身上 tpl: '<tpl for="."><div ext:qtip="{name ...
- 加载为应用程序池‘DefaultAppPool'提供服务的进程失败,应用程序池被禁用【解决方法】
iis应用程序池不能启动2008年03月13日 星期四 15:29iis应用程序池不能启动.WINDOWS2003 ENT SERVER(64位)环境下(测试过32位系统一样操作无此问题),当打开“应 ...
- WP8.1 页面导航 缓存问题
最近开始学习wp8.1开发,在页面的导航学习时发现了一点问题,即当使用Frame.Navigate()方法进行页面的跳转时,每次都会重新实例化一个页面.而在新的页面采用Frame.GoBack()或者 ...
- pom.xml配置
1:头部引用 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3 ...
- 表单提交---前端页面模拟表单提交(form)
有些时候我们的前端页面总没有<form></form>表单,但是具体的业务时,我们又必须用表单提交才能达到我们想要的结果,LZ最近做了一些关于导出的一些功能,需要调用浏览器默认 ...
- mysql数据库的连接
public TJb checkjbByschool(long id)throws ClassNotFoundException,SQLException { Class.forName(" ...
- setInterval()-----------js 函数总结
setInterval() 方法可按照指定的周期(以毫秒计)来调用函数或计算表达式. setInterval() 方法会不停地调用函数,直到 clearInterval() 被调用或窗口被关闭.由 s ...
- 【2】开发环境的搭建,Ubuntu14.04
这里使用的是Ubuntu14.04 Unity 更新源 首先,将更新源更换为国内更新源,我这里使用的是网易的更新源 sudo gedit /etc/apt/sources.list deb http: ...
- jQuery中$符号冲突问题 (转载)
Jquery的$命名冲突: 在Jquery中,$是JQuery的别名,所有使用$的地方也都可以使用JQuery来替换,如$('#msg')等同于JQuery('#msg') 的写法.然而,当我们引入多 ...