Excel CustomUI ribbon layout

2020-03-03 09:43发布

I'm trying to create a custom ribbon for excel with a group that looks like the image below. (2 rows of buttons with a dropdown box below).

example of desired result

I am beginning to think that it cant be done exactly how I'd like.

I have tried a few different ways (one of which is below) but they all result in the same output. 3 columns, 2x2 buttons with the dropdown box in the third column.

Does anyone know if this is possible?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="Ribbon.onLoad" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon>
      <tabs>
         <tab id="toolRibbon" label="redacted">
            <group id="groupDocument" label="Secret Document">
               <box id="z" boxStyle="vertical">
                  <box id="a" boxStyle="horizontal">
                     <box id="aa" boxStyle="vertical">
                        <button id="aaa" label="AAA" />
                        <button id="aab" label="AAB" />
                     </box>
                     <box id="ab" boxStyle="vertical">
                        <button id="aba" label="ABA" />
                        <button id="abb" label="ABB" />
                     </box>
                  </box>
                  <comboBox id="b" label="Looms">
                     <item id="ba" label="BA" />
                     <item id="bb" label="BB" />
                     <item id="bc" label="BC" />
                  </comboBox>
               </box>
            </group>
         </tab>
      </tabs>
   </ribbon>
</customUI>

标签: excel ribbon
1条回答
该账号已被封号
2楼-- · 2020-03-03 10:21

After looking through the available controls more thoroughly I found the buttonGroup which allows me to have buttons side-by-side.

Now to make them the right size..

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon>
      <tabs>
         <tab id="toolRibbon" label="redacted">
            <group id="groupDocument" label="Specia; Document">
               <buttonGroup id="a">
                  <button id="aa" label="AA"/>
                  <button id="ab" label="AB"/>
               </buttonGroup>
               <buttonGroup id="b" >
                  <button id="ba" label="BA"/>
                  <button id="bb" label="BB"/>
               </buttonGroup>
               <comboBox id="c" label="Looms">
                  <item id="ca" label="ca"/>
                  <item id="cb" label="cb"/>
                  <item id="cc" label="cc"/>
               </comboBox>
            </group>
         </tab>
      </tabs>
   </ribbon>
</customUI>
查看更多
登录 后发表回答