Excel Custom RibbonUI;添加菜单的节标题 [英] Excel Custom RibbonUI; Add Section Title for Menu

查看:218
本文介绍了Excel Custom RibbonUI;添加菜单的节标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行2016独立Excel(32位版本)。我一直在建立一个自定义的功能区,到目前为止这么好。文档非常流畅,写得很好。但是,我无法找到任何方法来包含菜单部分标题,如下所示:





具体参考图片中的部分标题(即单元大小,可见性等)。我看到其他加载项模拟这个,除非它们是COM加载项。以下是我参考的文档:

 < menuSeparator id =someIDtitle =测试标题/> 


Im running 2016 Standalone Excel (32bit version). I've been building a custom ribbon and so far so good. The documentation is pretty fluid and well written. However, I cant find any way to include menu 'section titles' as seen below:

Specifically referencing section titles like in the picture (i.e., 'Cell size', 'Visibility' etc). I've seen other Add-Ins emulate this, unless they are COM Add-Ins. Here is the documentation I reference: https://msdn.microsoft.com/en-us/library/dd911038(v=office.12).aspx

Is it out of date? I've tried adding 'Menu with Title' to my project but that doesn't even work. I've also tried adding <labelControl /> , and the ribbon doesn't even load when the labelControl is within a Menu.

Additionally, my version of Excel won't even display a <dialogBoxLauncher> so I'm concerned some things just aren't compatabile with my Excel version to begin with. I'm following the documentation easily and everything else has worked just fine. I even have a editBox in the ribbon I use and don't run into any 91 errors with it. So I know it's not me.

Can anyone duplicate this with the provided API? My ribbon is structured with XML, so I've reduced as much error potential as possible, is that my problem? Should there be run-time code implemented specifically for section titles?


Short snippet of my setup

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnRibbonLoad">

<ribbon>
<tabs>
<tab idMso="TabHome">        

<group id="GroupTextTools" insertAfterMso="GroupFont" label="Text Tools">
    <gallery  id="textcase_gallery" label="Case Select" columns="1" size="large" imageMso="WordArtInsertDialogClassic" onAction="TextCase_SwitchCase" >
        <item id="textcase_CapsButton" imageMso="TextAllCaps" label="Uppercase" screentip="Changes selected cells to all uppercase" />
        <item id="textcase_ProperButton" label="Propercase" imageMso="ChangeCaseDialogClassic" screentip="Changes selected cells to proper case" />
        <item id="textcase_LowerButton" label="Lowercase" imageMso="FontSizeDecrease" screentip="Changes selected cells to all small case" />
    </gallery>
</group>
</tab>

<tab id="CustomTab" label="*removed*" insertAfterMso= "TabDeveloper">

<!--
  GROUP A
-->
<group id="GroupFileOptions" label="File Options">

  <button id="fileoptions_CloseButton" label="Close &amp;&amp; Reopen" onAction="RunMacro" imageMso="SourceControlCheckIn" size="large" screentip="Saves Document, Closes &amp;&amp; Reopens immediately"/>

  <menu id="exportingmenu" label="Exporting" imageMso="FileCheckOut" size="large" screentip="Exporting Options">
      <menu id="exportmenu_AsRange" label="As Range"> <!-- This is where I would like section Titles to be instead of another menu -->
        <button id="exportmenu_range_CSVCButton" label="To CSV w/commas"/>
        <button id="exportmenu_range_CSVSButton" label="To CSV w/spaces"/>
        <button id="exportmenu_range_PDF" label="To PDF"/>
      </menu>
      <menu id="exportmenu_AsSheet" label="As Sheet"> <!--Goal is for this to be a section title, where I tried putting a <labelControl> -->
      </menu>
  </menu>

</group>

<!-- .... -->
</tab>
</tabs>
</ribbon>
</customUI>

解决方案

After some trial and error, and an involuntary push from David Zemens by troubleshooting my errors, I've found that by cross referencing all the things I've tried with their Parent Elements, the only one that makes logical compiling sense is a <menuSeparator>, which just so happens to have a 'title' attribute. So by setting that you get a beautiful section title as shown:

<menuSeparator id="someID" title="Test title"/>

这篇关于Excel Custom RibbonUI;添加菜单的节标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆