VSTO to NetOffice

Mar 18, 2012 at 1:53 AM
Edited Mar 18, 2012 at 7:03 AM

Is there an equivalent of Globals.ThisAddIn.Application in NetOffice

Coordinator
Mar 18, 2012 at 11:17 AM

Hello,

NetOffice is designed as substitute for the interop assemblies. These Globals are VSTO specific. VSTO is an own concept/framework top of the interop assemblies. thats the reason for, its easy to convert a interop assembly project to NetOffice but more difficult to convert a VSTO project.
anway, the autor from the Excel-DNA project suggest me to create a globals module 3 weeks ago. this module is not excactly the same as VSTO.
its the <Global> module with all the nice helpermethods und properties(also application object) what you know from VBA maybe, this module comes with NetOffice 1.4.1 next week. for the future i want more VSTO features in NetOffice of course, its still a young project :-) 

*Sebastian

Aug 26, 2013 at 8:11 PM
Similar to the question above I used to use the line below in a static function to return a reference to the com addin:

return Globals.ThisAddin;


Can you please tell me how I can get a reference to the current addin object.

PS only been using this one day and it looks like a great project, thanks.

AT
Coordinator
Aug 26, 2013 at 9:07 PM
NO spend a static helper module for the office application but not for the adinn instance currently (except for the NO tools namespace with more options)
but its easy to implement i find:
// example
class MyAddin
{
MyAddn()
{
   _singleton = this;
}
internal static Addin Singleton { get{ return _singleton;} } 
private static Addin _singleton;
}

// usage
return MyAddin.Singleton;

*Sebastian
Aug 26, 2013 at 9:27 PM
Edited Aug 26, 2013 at 9:50 PM
Sorry I didn't read you code properly, you are answering my question I will give it a go now

Cheers

AT
Aug 26, 2013 at 9:57 PM
Yep that works thank you so much :)