Is there a way to use Netoffice to customize Office/Excel Ribbon at runtime, My concern is that I am trying to make plugin-able addin that adds button to Ribbon based on available action of my plugins.
I actually created my tab using XML but I can't figure out how to add items dynamically at runtime.
Thank you for help.
As far as I know netoffice doesn't provide anything for customizing the Fluent UI. The Ribbon UI is a static thing from its birth. The only possible dynamism is callbacks. For example, you can define a dynamicMenu which provides the getContent callback (gets an XML string that contains the contents of this dynamic menu).
Read more about the Fluent UI (aka Ribbon UI) in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
Also you may find these articles helpful:
Chapter 11: Creating Dynamic Ribbon Customizations (1 of 2)
Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)
Related
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?
The ribbon tab should be instantiated first. There are two main ways for creating a custom ribbon UI in Visual Studio:
Walkthrough: Create a custom tab by using Ribbon XML
Walkthrough: Create a custom tab by using the Ribbon Designer
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:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
Read more about repurposing built-in controls in the Temporarily Repurpose Commands on the Office Fluent Ribbon article.
I want to add multiline item to ribbon menu (Microsoft.Office.Tools.Ribbon.RibbonMenu) in my office add-in like following image. but I don't know what these items should be?
*RibbonButton doesn't support multiline Label.
*RibbonLabel doesn't support variable font styles (like Bold and Normal).
UPDATE: if these features are not supported, is there another component (say DevComponents, Telerik, ...) that supports them?
Unfortunately not all ribbon features are available for developers. There is no way for add-in developers to implement something like that unfortunately.
You can read more about available ribbon controls and their attributes in the following series of articles in MSDN:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
I try to create a listbox with custom XML entries/values which appears after the user enters a text in a editBox.
The developer environment is C# Outlook 13/16 VSTO Plugin.
My problem is, I can only access with Ribbon Controls to an editBox or a comboBox.
With the comboBox I am able to add my custom XML entries like:
foreach (XmlNode node in source.DocumentElement.SelectNodes("/path/item/value"))
{
RibbonDropDownItem item = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem();
string text = node.InnerText;
item.Label = text;
this.comboBoxCompose.Items.Add(item);
//System.Diagnostics.Debug.WriteLine(text);
}
The editBox e.g. does NOT provide to add items...
The comboBox is the wrong choice for me, because it is a dropdown selection.
Is there a way to implemnet a listBox with custom results like in the picture enclosed. Do I have to combine it with an other API/library?
Would be nice if someone could help here.
No, there is no way. The Fluent UI provides a definitive set of controls.
You can read more about the Fluent UI (aka Ribbon UI) in the following series of articles:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
As a workaround you may consider creating a custom UI on the Outlook form region instead of Ribbon where you are free to use any .Net controls. See Creating Outlook Form Regions for more information.
I am creating Outlook ribbon which has couple of dynamic menus in it, I am invalidating ribbon on click of dynamic menu buttons. Problem I am facing is when I say ribbon.invalidate() contents of dynamic menu are not cleared and holds contents which were added previously.
How can I clear the dynamic menu and force to rebuild it ?
What is your ribbon XML markup?
In essence you needed to implement the getContent callback in the code for the dynamic menu control where you return an appropriate dynamic ribbon XML markup.
You can read more about the Fluent UI in the following articles in MSDN:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)
Also you can read about dynamic customizations in the Fluent UI and find the sample code:
Adding Custom Dynamic Menus to the Office Fluent User Interface
Chapter 11: Creating Dynamic Ribbon Customizations (1 of 2)
Chapter 11: Creating Dynamic Ribbon Customizations (2 of 2)
I created a custom tab at the backstage view in Office 2010. Like this.
Now what i want to have is an event, that triggers when my tab is being pressed. Unfortunately the tab does not have an OnAction method or something like that.
Any ideas?
There is no such event for tabs. But you can specify getVisible callback for any control on that tab. Thus, the callback will be invoked at least when the tab is clicked for the first time.
You can read more about the Fluent UI (aka Ribbon UI) in the following series of articles in MSDN:
Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 2 of 3)
Customizing the 2007 Office Fluent Ribbon for Developers (Part 3 of 3)