如何将自定义菜单项添加到office-2007中的office-button?

时间:2016-06-30 07:34:22

标签: c# ms-office office-2007

如何将自定义菜单项添加到office-2007中的office-button?

在Office 2007中,我设法将一些自定义菜单项添加到办公室按钮,请参见下图:
enter image description here
如你所见,我添加了一个“标签”和一个“按钮”。 虽然这个按钮缺少一些我想看到的东西。

我想要做的是创建一个按钮,如下图所示的“Word文档”按钮。一个带有标题形式的按钮和位于其下方的描述 enter image description here

我尝试了几件事,并尝试了'Ribbon.xml'中的几乎所有选项。

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">
<ribbon>
<officeMenu>
  <menu id="test" label="My Menu">
    <button id="id001" description="desc" enabled="true" label="label" screentip="screentip" supertip="supertip" tag="tag"/>
    <button id="id002" imageMso="AdpPrimaryKey" label="A button" description="desc" onAction="action" visible="true"  />
  </menu>
</officeMenu>
</ribbon>
</customUI>

2 个答案:

答案 0 :(得分:1)

也许您可以通过以下网站上的ribboneditor找到一些信息:http://www.andypope.info/vba/ribboneditor.htm

使用OfficeMenu示例,您将获得以下xml:

 <!--RibbonX Visual Designer 1.9 for Microsoft Word 12.0. XML Code produced on 2010/02/02-->
<customUI  xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
    <ribbon >
        <officeMenu >
            <splitButton  id="Splitbutton1" >
                <button 
                    id="Button1"
                    imageMso="AdpPrimaryKey"
                    label="Company Lockers"/>
                <menu 
                    id="Menu1"
                    itemSize="large"
                    label="Menu1">
                    <menuSeparator 
                        id="Menuseparator1"
                        title="Lock away your company files"/>
                    <button 
                        description="Place your workbook in the Corporate Locker. Information may be accessed by others"
                        id="Button2"
                        imageMso="ReviewProtectWorkbook"
                        label="Corporate Locker"/>
                    <button 
                        description="Place your workbook in a Group Locker. Only members of your Group can access it."
                        id="Button3"
                        imageMso="SheetProtect"
                        label="Group Locker"/>
                    <button 
                        description="Place your workbook in a Locker that can only be accessed by users you have invited."
                        id="Button4"
                        imageMso="ProtectDocument"
                        label="Invite Locker"/>
                    <button 
                        description="Place workbook in a Private Locker that can only be accessed by you."
                        id="Button5"
                        imageMso="Lock"
                        label="Private Locker"/>
                </menu >
            </splitButton >
        </officeMenu >
    </ribbon >
</customUI >

答案 1 :(得分:0)

您可以使用鼠标重新排列和更改工具栏按钮,菜单和菜单命令,也可以使用“重新排列命令”对话框,您可以使用键盘访问该对话框。您可以使用键盘完成的任务标识为(键盘可访问)。 Check this out to find more