Nivitha G
Nivitha G

Reputation: 283

How to use the RibbonTab interface in c#?

I am working in excel VSTO add-in.

In excel, having built-in tabs, groups, and controls in the ribbon.

I am trying to use the Microsoft.Office.Tools.Ribbon RibbonTab interface.

But I am not able to use this interface.

private RibbonTab hometab;

public bool ShowVisibleView(Office.IRibbonControl control)
{
     hometab.Name = "View";

     var groupList = hometab.Groups;

     return true;
 }

Here, hometab comes as null. So, I can't able to set the value for Name property in RibbonTab.

How can I achieve this?

Upvotes: 0

Views: 243

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49397

The ribbon tab should be instantiated first. There are two main ways for creating a custom ribbon UI in Visual Studio:

You can't also manage built-in controls on the ribbon. The best what you could do is to repurpose built-in controls or build the ribbon from scratch.

The Fluent UI (aka Ribbon UI) is described in depth in the following series of articles:

Read more about repurposing built-in controls in the Temporarily Repurpose Commands on the Office Fluent Ribbon article.

Upvotes: 2

Related Questions