We are embedding a word control inside of a winforms app, and need to hide and disable the ribbon on Office 2007 and 2010.
Is it possible to hide/disable the office 2007/2010 ribbon programmatically using the office interop dlls? Is there another method available to do this?
I don't think you can disable the ribbon as such, but using a custom XML file you can hide the default tabs, groups and commands (or add your own). Setting the custom XML file can be done via interop (see IRibbonExtensibility and GetCustomUI). This may not be perfect, but perhaps better than nothing.
It is not possible to disable the Office 2007/2010 ribbon.
In the user interface, Ctrl F1 will accomplish the hiding.
If you were able to send keys to the embedded app, that'd accomplish that.
System.Windows.Forms.SendKeys.Send("^{F1}");
More on SendKeys at MSDN.
Related
I have written an Excel VSTO Addin with C# that is compatible with Excel 2013 as well as Excel 2016/365.
In Excel 2013, I see a tooltip window for every ribbon button, that contains my addin's name and a link to more information, which simply opens a help topic about addins.
I don't want either. If I add a "ScreenTip" or a "SuperTip" to my ribbon buttons, they will be added on top of this unwanted tooltip, but they don't replace it.
Excel 2016 does not show such tooltips.
How can I get rid of them? I only want my own ScreenTips and SuperTips
Since I am using the VS Ribbon designer, I have no, and don't want to have, access to the underlying ribbon XML.
You can't get rid of them, that part is controlled by Microsoft. Assumedly it was part of Microsoft's goal of helping to inform users that a control is not a Standard Office control, so that when it breaks, they don't blame MS for it, but instead recognize the identifier listed there and then seek support from whoever made the Add-In.
Is it possible to handle button click events on a custom ribbon button from another application using interop?
So if I've created a Word 2010 application add-in which creates a custom tab with several buttons and then I instantiate a Word application from a C# win forms application using interop, how would I then go about wiring up to the button click events on my custom ribbon from the win forms app? With Word 2003 I could access the buttons through the CommandBars collection and then simply wire up to the click event.
After some further reading, I guess what I'm trying to do is find out how to get access to the Ribbon object model using interop. Is this possible?
[Edit]
For anyone that's interested. When I wrote this question I knew of another way to solve my problem, but it means a lot of extra work changing my existing implementation to upgrade from Office 2003 to Office 2010, and so I was hoping there would be away to access the Ribbon object model outside of a VSTO add-in.
My solution is to use an IpcChannel to make calls from the vsto add-in to my win-forms application. So my win-forms application initialises the Word instance and then opens up a server channel. In the vsto add-in I handle Application.DocumentOpen and if the document is owned by my application I open a client channel to my application. I can then make calls back to my win-forms app from the vsto add-in through the use of shared interfaces.
While this technique works, it does have some draw backs. If the calls through the ipc channel are synchronous then my application can't touch the word object because a deadlock occurs. Making asynchronous calls introduces other problems, but I found that I could block the Word window with a modal dialog without ending up deadlocked.
While this isn't an exact answer to my original question, it is an alternative and so I thought I would share this with anyone else having this problem.
If anyone does know how to access the Ribbon object model outside of VSTO I would still be interested to know how.
Edit: I finally discovered a code.msdn.microsoft.com project that incorporates native C# ribbon manipulation. Use that instead of any VBA business.
Original Post:
You don't need VSTO to access the ribbon programmatically. Visit Word Articles for a brief Word VBA example.
I'm certain there's a way to accomplish the same in C#, but I have yet to implement one. If I find one, I will be certain to share. (I previously contributed an answer that contains a C#-VBA workaround.)
As part of my Outlook Addin I would like to add a control to the Ribbon which has the same format as the 'Home\Quick Steps' and 'View\Arrangement' controls. Does anyone know if these can be created by Addins?
These are variation of the in-ribbon gallery, you are currently not able to build ones yourself, you can only do drop down galleries. I believe that it has been request by alot of devs.
Marcus
Is there a way to my WinApp written in C# using Visual Studio 2008 have menu controls which look like on these We can fund in Office 2007.
Menu http://lh6.ggpht.com/_l7ldTfcnI34/S0wk1-eGSYI/AAAAAAAAEYU/IrTyYDV2Muo/s800/menus.jpg
Yes, you can get a free license to incorporate the Office 2007 user interface into your program.
http://msdn.microsoft.com/en-us/office/aa973809.aspx
You can't get a free control from microsoft, but there are a bunch of people who will sell you a version. DivElements.co.uk are one example (no affiliation).
Microsoft only have a version for C++ and for WPF, not for winforms.
Well, out of the box from VS.NET, the toolbar controls aren't anywhere near what you want in Office apps.
You can write your own custom ones or simply get 3rd party components.
E.g.:
http://www.devcomponents.com/dotnetbar/
http://www.componentone.com/SuperProducts/MenusandToolbarsWinForms/
etc etc
You can use the Telerik RadRibbonBar For WinForms by registering at this link below
http://www.microsoft.com/express/registration/
this provides you with a free ribbon bar control which you can use with C# in your application and can even distribute the applications without any royalities to Telerik.
Otherwise like stated in other answers you would need to buy some commericial toolkit like DevExpress etc.
Here it comes to WPF http://fluent.codeplex.com/
I'm trying to dynamically customize the built-in Ribbon Controls on an Office2007 ribbon by adding C# objects such as RibbonTab, RibbonGroup, RibbonControl to the Ribbon. I have been unsuccessfull in disabeling any existing built-in controls, however I can add my own group. Now i'm thinking that disabling or hiding existing ones not be possible.
If anyone been able to hide a built-in control using code or the designer using .NET VSTO Office 2007 development, can you please post the code you used?
Thanks!
Here is a Stackoverflow question that talks about overriding built-in ribbon commands. Here is an MSDN video that shows it as well.