-2

I am trying to get all existing Ribbon tabs in a word document programmatically using C# code.

But I couldn't find any method to do it. Can someone show me how to do that using C#?

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
NetNet
  • 3
  • 1
  • As it stands this question is too broad and not very clear. Please provide the code you have tried and explain what you mean by get all "tabs" in a Word document? What, more exactly, do you need to do? – Cindy Meister Mar 04 '19 at 06:28
  • please open word document--> options --> Customize Ribbon then you got a drop down list of all main tabs in the document. (Home, Insert, .....), my question is how to get this menu programattically? – NetNet Mar 04 '19 at 15:59

1 Answers1

0

It is not possible to get a list of information about the Ribbon, whether the tabs or the commands listed in a group or menu. There is no interface exposed to the Developer that provides this information. By design, much of the Ribbon is not exposed except to a "container" that customizes the Ribbon... and then primarily what's relevant to customizing.

The menu command mentioned in the question lists only the built-in tabs, not any custom ones that might be added. This information could, possibly, be picked up using the Accessibilty APIs, but it's not certain...

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43