Excel 2013 VSTO Ribbon & Edit Controls - c#

The quick overview is I have an Excel AddIn targeting Excel 2013. The AddIn has a custom RibbonUI that contains a couple of read-only EditBoxes that contain workbook specific values. The same AddIn works fine in Excel 2007 & 2010, with the MDI interface, but with 2013 and its SDI interface.
With a simple VSTO AddIn, I've added a simple RibbonUI with an EditBox. For testing purposes, I'm just trying to get the EditBox to reflect the Workbook.Fullname of the window in which it appears. Far as I've been able to find, the RibbonUI is a singleton and there's no apparent way to control the values of any edit controls on a per workbook/window basis. If I have 2 Excel Workbooks open and switch back and forth (updating the value on the ActiveWorkbookChanged property of the Excel.Application), both workbooks always reflect the most recent value. Worse yet, only one event fires, but both windows are updated.
The crux of the problem is that I cannot find a way to control in a per window/workbook manner the value of an edit control. I found Programming for the Single Document Interface in Excel 2013, except it doesn't mention, or provide any references on how to do it, just that you need to.
I'll try and update later with some examples, but I'm wondering if anyone has solved this problem with SDI under Excel 2013? It is obvious looking at built-in Ribbon controls in 2013 that is is possible to do this (for instance, Font settings), but documentation seems exceptionally sparse on how to accomplish something similar from a user AddIn.

Related

Outlook VSTO Add-In loads, but ribbon doesn't

I'm making an Outlook VSTO Add-In with a ribbon and the ribbon stopped loading. I'm using the Ribbon (Visual Designer). It was loading fine, I made some code changes, fired up a new session, and it wouldn't load. There is no "Add-Ins" item in the ribbon.
I think the problem is in my Outlook, not in my project.
I created a new project to make sure there wasn't something wrong with my larger project, using the most basic code with no code in the addin class and only a single group in the ribbon. It still won't load.
ThisAddIn_Startup is firing, so I know the addin is loading in Outlook
I've tried both Ribbon Designer and XML
RibbonType is set to Microsoft.Outlook.Explorer
I've deleted all .vsto files and removed references in the registry
I've rebooted
First of all, I'd suggest making sure you don't have any ribbon UI errors at runtime. Here is what MS states:
By default, if a VSTO Add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.
See How to: Show Add-in user interface errors for more information.
Make sure that you did all the steps described in the following articles (one of them):
Walkthrough: Create a custom tab by using the Ribbon Designer
Walkthrough: Create a custom tab by using Ribbon XML
If you use the ribbon XML approach you can set up a breakpoint in the ribbon's getCustomUI callback to make sure the callback is invoked and what ribbon XML is returned.

create Power Point Custom Element on the slide

I'm just wondering if it's feasible to create interactive custom element for PowerPoint and add it to presentation programmatically using OpenXml for example.
For instance, we can insert a picture on a slide. So, I want to insert a picture on the slide and be able to change size, colour or shape right in playing mode.
Another example, I want to have buttons on my presentation and be able to click on it to get some action done, again, right in playing mode. In other words, I want to make my presentation interactive during the playing mode.
The first thing that I came up with, is using VSTO to create a plug-in, however as far as I know VSTO and OpenXml give an opportunity to play with XML structure and that's it.
Maybe I googled it incorrectly and used wrong keywords but I've found nothing
UPDATE
One of the possible ways that it can be done with (I think so) is adding a custom object, like excel spreadsheet. However, in presentation mode, it's not interactive either.
VSTO can create COM add-ins that work with the PowerPoint object model directly; you don't necessarily need to do anything with XML.
You can also create add-ins using the VBA that's built into PowerPoint or distribute presentations that include VBA.
A VSTO or VBA add-in solution would require that the user install your software, which may or may not be practical in your situation.
VBA in the presentation file itself, saved as a PPTM rather than PPTX, could probably do all that you want to do. It would require no special installation, but the user's security settings would have to permit macros.
Anything that involves a code solution would need to be permissible under the user's or enterprise's security restrictions, of course.
While you can't change picture size etc in slideshow mode, you can add action buttons that add some forms of interactivity to your presentation; these require no code at all. It's a built-in PPT feature.

Attach a .net control to a worksheet without VSTO (but Excel-DNA)

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.

Create Add-In for Outlook 2013 for add a Button

Good morning,
my company is looking for a solution in order to distribute an add-in for Outlook 2013 that add a button in the ribbon. I want to create an add-in for Outlook 2013 and I saw that is possible using Visual Studio (I use VS 2013 or 2010) but I don't understand how to add a button in the ribbon (in particular in Home section) and execute a macro when I click on the button (the macro is already created). I read this tutorial https://msdn.microsoft.com/en-us/library/cc668191.aspx and this worked. Someone can help me with some piece of code(c#)?
Thanks for your help
VSTO provides two main ways for customizing the Ribbon UI:
Using the Ribbon designer. See Walkthrough: Creating a Custom Tab by Using the Ribbon Designer for more information.
Using the Ribbon XML markup. See Walkthrough: Creating a Custom Tab by Using Ribbon XML for more information.
You need to specify the idMso attribute of the built-in tab if you need to add your custom controls there. See Office 2013 Help Files: Office Fluent User Interface Control Identifiers for control IDs.
Finally, I'd suggest moving your VBA macro to the add-in. It will improve the overall performance and allows to use the BCL classes (a wide varioety of controls and components) for getting the job done. Moveover, you will be able to deplay the add-in easily. VBA macros are not designed for deployiong on multiple PCs.

Best way to control Word from Windows Forms?

I am updating a Windows Forms application that was written for Office 2003. It would open Word, populate it with text from the database, create buttons appropriate for the user's security roles, and handle button clicks. The old way was with CommandBars. The Word documents created this way were stored as DB Blobs, so they were only ever available via the Forms application. That is the functionality I need, but without CommandBars.
Now, we have the Ribbon, Action Panes, VSTO, and OpenXML. I know my way around C#, but I'm new to all of these technologies.
I imagine a solution where I set up a template with the proper buttons on a nice ribbon, and the buttons raise events. If someone just tried to use the template by itself, there would be no data and the events would do nothing. But my Windows Form could create a new document based on the template, populate it with text from the database, hide inappropriate buttons, and handle button click events. Easy peasy.
I began by adding a Word 2010 Template project and making a ribbon for it. It looks nice in the debugger. But, I can't create a new document with it from a Console app. Word launches, but the ribbon isn't there. There's a note in the documentation that "If a Microsoft Office Word template has managed code extensions, the project assembly is not called if the template is attached as a global template or loaded from the startup directory of Word. In addition, the document does not recognize the format of a template that is part of an Office solution." I believe this means my template is useless. I can't open Word and make a new document with my template or call the template from another project, so, pointless.
All the MS help has failed me, and mostly leads me in circles. I need some direction. For each piece of the scenario I described, what is the most appropriate modern technology? For each technology I need to use, what is the best resource for my situation?

Categories

Resources