Excel 2013 VSTO Ribbon & Edit Controls

Short overview: I have Excel targeting Add3 Excel 20113. AddIn has a custom RibbonUI that contains a pair of read-only EditBox that contain special values ​​for the workbook. The same AddIn works fine in Excel 2007 and 2010 with the MDI interface, but since 2013 and its SDI interface.

Using a simple VSTO AddIn, I added a simple RibbonUI with an EditBox. For testing purposes, I'm just trying to get the EditBox to display the Workbook.Fullname of the window in which it appears. As far as I could find, RibbonUI is singleton, and there is no obvious way to control the values ​​of any editing controls based on each book / window. If I have 2 Excel Workbooks workbooks and switch back and forth (updating the value of the ActiveWorkbookChanged property in Excel.Application), both workbooks always reflect the most recent value. Worse, only one event fires, but both windows are updated.

The main problem is that I cannot find a way to control the value of the edit control in a window / workbook. I found Programming for a single document in Excel 2013 , except that it does not mention or does not provide any links on how to do this, you need to.

I will try to update some examples later, but I am wondering if anyone solved this problem with SDI in Excel 2013? Obviously, in 2013, you can use the built-in ribbon controls that it is possible to do this (for example, font settings), but the documentation seems extremely sparse as to how to do something similar from a custom AddIn.

+4

Source: https://habr.com/ru/post/1538934/


All Articles