Home » excel » interop – Excel Ribbon XML how to do a control like the Excel "Pivot Table" control

interop – Excel Ribbon XML how to do a control like the Excel "Pivot Table" control

Posted by: admin May 14, 2020 Leave a comment

Questions:

I would like to create a Control like the Pivot-Table in an Add-In XML ribbon.

It’s like a clickable button at the top and a dropdown Label opening a menu.
Using the VSTO ribbon designer I am not able to reproduce it.

In fact what I need is the XML for this control.
Any idea ?

enter image description here

How to&Answers:

You’re seeing a splitButton control, which needs to have exactly two children:

  • a button or toggleButton, and
  • a menu.

In this case the splitButton has an image set (the pivot table picture) and a child button (with the label ‘PivotTable’). The menu then has two children, the two buttons below called PivotTable and PivotChart.

An xml fragment might look like this:

          <splitButton id='split' size='large'>
                <button id='splitButton' label='SplitButton' image='M'  />
                <menu id='splitMenu' >
                  <button id='splitMenuButton1' label='SplitMenuButton1' />
                  <button id='splitMenuButton2' label='SplitMenuButton2' />
                </menu>
          </splitButton>

giving me this in Excel:

splitButton in Excel