Ribbon1: 在Office菜单中添加项目
来源:互联网 发布:蒋介石发动内战数据 编辑:程序博客网 时间:2024/04/29 20:41
Office菜单就是应用程序窗口左上角的一个小的应用程序按钮,这个按钮被称作Office按钮,包含一些通用的操作或命令,例如打印、保存和发布。定制Office菜单时,其下的命令将影响整个文档,而不是文档的特定部分,例如段落或字体格式。
Office菜单使用下面的XML标记:
Office菜单使用下面的XML标记:
<officeMenu><!-- Everything else goes here --></officeMenu>
下表列出了Office菜单的子元素。
checkbox 引用复选框控件gallery引用库控件toggleButton引用切换按钮,在True/False值之间切换menuSeparator引用菜单分隔条项splitButton引用能够用于容纳其它控件例如按钮控件的拆分按钮menu引用能够用于容纳其它控件例如按钮控件的菜单控件dynamicMenu引用动态菜单,能够在运行时接受动态的XML内容
下图为定制Excel中Office菜单的一个示例。在Office菜单中添加了一个拆分按钮My Tools,包含两个组My Toolset1和My Toolset2。
在这个示例中,我们创建了包含菜单(根据特定任务组织的几个按钮)的拆分按钮,XML代码如下:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"><ribbon startFromScratch="false"><officeMenu><splitButton id="rxsbtn" insertBeforeMso="FilePrintMenu"><button id="rxbtnSplitMain" label="My Tools" imageMso="CreateModule"/><menu id="rxmnu" itemSize="large"><menuSeparator id="rxsep1" title="My Toolset 1"/><buttonid="rxbtnEmailSheet"imageMso="FileSendAsAttachment"label="E-mail sheet as attachment" description="E-mail the active sheet as an attachment" onAction="rxshared_click"/><buttonid="rxbtnEmailSupport"imageMso="MessageToAttendeesMenu"label="E-mail technical support" description="E-mail technical support about issues on this application..." onAction="rxshared_click"/><buttonid="rxbtnEmailBug"imageMso="ResearchPane"label="E-mail a bug" description="E-mail technical support about bugs found on this application..." onAction="rxshared_click"/><menuSeparator id="rxsep2" title="My Toolset 2"/><buttonid="rxbtnPrintPDF"imageMso="FilePrint"label="Print to PDF" description="Print active sheet to PDF file format" onAction="rxshared_click"/></menu></splitButton></officeMenu></ribbon></customUI>
实际上,菜单控件也可以提供相同的定制而不须像拆分按钮那样的中间步骤,例如上例可以修改如下:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"><ribbon startFromScratch="false"><officeMenu><menu id="rxmnu" insertBeforeMso="FilePrintMenu" label="My Tools" imageMso="CreateModule" itemSize="large"><menuSeparator id="rxsep1" title="My Toolset 1"/><buttonid="rxbtnEmailSheet"imageMso="FileSendAsAttachment"label="E-mail sheet as attachment" description="E-mail the active sheet as an attachment" onAction="rxshared_click"/><buttonid="rxbtnEmailSupport"imageMso="MessageToAttendeesMenu"label="E-mail technical support" description="E-mail technical support about issues on this application..." onAction="rxshared_click"/><buttonid="rxbtnEmailBug"imageMso="ResearchPane"label="E-mail a bug" description="E-mail technical support about bugs found on this application..." onAction="rxshared_click"/><menuSeparator id="rxsep2" title="My Toolset 2"/><buttonid="rxbtnPrintPDF"imageMso="FilePrint"label="Print to PDF" description="Print active sheet to PDF file format" onAction="rxshared_click"/></menu></officeMenu></ribbon></customUI>
结果如下图所示:
可以看出,实现的效果并没有太大的差异。如果认真观察,就会发现拆分按钮在箭头和按扭之间有一条分隔线,而菜单则没有。
上面的示例是在Office菜单中添加自已自定义的项目,当然也可以在Office菜单里的内置元素中添加自定义项目或内置项目,此时您需要知道在什么元素中放置项目,下表列出了Office菜单元素。
表:Office菜单元素
- Ribbon1: 在Office菜单中添加项目
- 在系统菜单中添加菜单项
- 在系统菜单中添加菜单项
- 在对话框中添加菜单
- 在Activity中添加菜单
- 为Office文档添加Windows窗体控件:在运行时向文档级项目中添加控件
- 在VB中动态添加弹出菜单
- 在窗体中添加右键菜单
- 在Outlook中添加自己的菜单
- 在Outlook中添加自己的菜单
- 在QT中添加右键菜单
- 在右键菜单中添加应用程序
- 在QT中添加右键菜单
- 如何在Excel中添加下拉菜单
- 在QT中添加右键菜单 .
- UltraEdit在win7中添加右键菜单
- android4.2 在设置中添加菜单
- 在MFC对话框中添加菜单
- int在64位机或64位编译器中到底占用几个字节
- SQLSERVER函数
- 关于今天数据库学习的一些内容和总结
- VC HID
- 可展开的TextView
- Ribbon1: 在Office菜单中添加项目
- [Android]免费帮你去广告,甚至是破解
- oracle distinct用法
- 三款ActiveX图表控件对比评测 Pro ActiveX、ProEssentials、ChartDirector
- s5pv210 uboot-2012-10移植(四) 之使系统工作在1000Mhz
- Naming Files, Paths, and Namespaces
- 代理模式
- TCP
- 搜索引擎自然排名的生存法则