I'm experimenting with some custom ribbons in excel, and once of the behaviors I want to try and achieve is to mimic the built-in excel ribbon disabled/enabled states. I.e. If I'm viewing a ChartSheet or if I'm in edit mode, most of the ribbon tabs/buttons grey out.
Is there a way I can read the enabled states off something like the Chart's Ribbon Tab group?
In my research, I haven't been able to find something that does this. The closest thing I've found is overriding the existing ribbons and encasing them in your own custom controls using the "startFromScratch" value, but this feature is more for me to control the visibility of built in tabs, which I don't need.
Thanks
Related
How can one programmatically determine if an Outlook ribbon is displayed in Simplified or Classic mode? Is there a related property and/or event which a VSTO add-in can access? Have not been able to find any info on this. This would be used to adjust the label and image of our ribbon buttons depending on the ribbon mode via the callbacks provided in our ribbon XML declarations. But maybe there is another way to do this?
I'm facing an issue using Microsoft.Office.Tools.Ribbonin my outlook add-in. I want to be able to implement custom colours onto the ribbon to match the theme of of the product. Here is a side by side comparison of something that i'd want to achieve, I'd also like to change the text to white.
From what I can see there is no properties that will allow me to change this from within the designer and I cannot find anyone who has attempted to change these colors.
Can't do that - the color of the ribbon is determined by the Office theme.
I'm trying to do something that I'm not sure is possible.
I want to use a .net 3rd party library that gives nice winform chart controls, to replace some (very complex and ugly) VBA generated charts in an Excel worksheet.
I'm using Excel-DNA (which is great BTW), and I managed to do all sorts of things with it, like displaying Winform forms in both sync and async way (thanks to https://github.com/Ron-Ldn/DotNetRefEdit)
So far, I managed to make my non modal form with the charts appear when I activate a particular worksheet, and by setting it's parent and topMost properties, it kinda have the expected behavior. But placing it is a real pain (different screen sizes) and I was wondering if there is a way to properly do it
So here's the question : Can I attach in some way a .Net form or a custom control to a worksheet, maybe even have it positionned relatively to a particular cell ? It must be non modal and it will display only if we are on a particular sheet.
I know with VSTO you could add a control to a worksheet, but I don't want to use VSTO. I also know that I could probably create my own ActiveX control and have it registered, and then place it in Excel like I would with another button control for example, but that seems hazardous according to what I read about it
Thank you for all ideas or suggestions
Consider creating a custom task pane (CTP) pinned to the right hand side of the Excel workbook (worksheets).
For more information on how to do this in ExcelDNA, see ExcelDNA GitHub Sample on CTP.
I am trying to add a button to the ribbon using CommandBars, but I can't find any example or a way to do that.
I cannot use the CustomUI XML because I need to change the visibility of the button, and it is not supported by the CustomUI XML.
I have found a CommandBar called "Ribbon" with a CommandBarControl that is called "Ribbon" as well, but I don't see how I use it to place a button on "TabHome".
Does anyone know what am I missing here? or can point me out to an example?
Thanks!
As far as I know, you can't use CommandBars to control ribbon. And it makes no sense to do so, as CommandBars technology is depreciated for ribbon ui, and basically supported for compatibility only.
Did not quite get why you don't want to use ribbon xml to customize ribbon? It's the official way. To control button visibility, you should simply set a "getVisible" attribute of the button to your event handler (callback) and and in that callback return true/false to show/hide the button...
What you can't show/hide dynamically are built-in office buttons, but you should be able to show/hide your own buttons without any issues.
Looks quite similar to this one:
Is there a way to use VBA and XML to add a button to the Office 2010 Ribbon depending on a string in the file name?
Is there any way how can I associate custom ribbon (custom tabs and buttons I created in VS designer) with a custom form region?
I know that I can extend the existing windows with my ribbon (such as Compose message, Contacts...), but how can I create a new tab with custom ribbons at the top and custom form region at the bottom. Do I have to create a custom message class?
Thanks.
You have to create a custom message class. Basically the ribbon and the form are two seperate mechanisms.
What you could try though, if its important for you, is invalidating the ribbon on activation of your form region and then programmatically update the ribbon according to your needs (dynamic updating of the ribbon at msdn).
If you mean it the other way around (showing a certain form region when your ribbon tab is activated) then you can't have it: there are no events/callbacks for the ribbon tabs being changed.
I have been trying to solve this issue and as Georg said the two are quite separate and behave very differently, so bringing them into line to make them appear like they are related is quite difficult.
You can have a look at my example twitter app at http://vstocontrib.codeplex.com/SourceControl/changeset/view/b35f26fdca15#src%2fDemos%2fTwitterFeedCore%2fTwitterFeed%2fContactFeed.cs
It relies on my VSTO contrib project, but it should allow you to easily achieve what you want.