Esempio n. 1
0
 public string GetCustomUI(string RibbonID)
 {
     try
     {
         return(ReadTextFileFromRessource("RibbonUI.xml"));
     }
     catch (Exception exception)
     {
         OfficeRegistry.LogErrorMessage(_hostApplicationName, _progId, "Error occured in GetCustomUI. ", exception);
         return("");
     }
 }
Esempio n. 2
0
 public void OnDisconnection(ext_DisconnectMode RemoveMode, ref Array custom)
 {
     try
     {
         if (null != _application)
         {
             _application.Dispose();
         }
     }
     catch (Exception exception)
     {
         OfficeRegistry.LogErrorMessage(_hostApplicationName, _progId, "Error occured in OnDisconnection. ", exception);
     }
 }
Esempio n. 3
0
        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            try
            {
                _application = Core.Default.CreateObjectFromComProxy(null, Application);

                /*
                 * _application is stored as COMObject the common base type for all reference types in NetOffice
                 * because this addin is loaded in different office application.
                 *
                 * with the CreateObjectFromComProxy method the _application instance is created as corresponding wrapper based on the com proxy type
                 */

                if (_application is Excel.Application)
                {
                    _hostApplicationName = "Excel";
                }
                else if (_application is Word.Application)
                {
                    _hostApplicationName = "Word";
                }
                else if (_application is Outlook.Application)
                {
                    _hostApplicationName = "Outlook";
                }
                else if (_application is PowerPoint.Application)
                {
                    _hostApplicationName = "PowerPoint";
                }
                else if (_application is Access.Application)
                {
                    _hostApplicationName = "Access";
                }
            }
            catch (Exception exception)
            {
                if (_hostApplicationName != null)
                {
                    OfficeRegistry.LogErrorMessage(_hostApplicationName, _progId, "Error occured in OnConnection. ", exception);
                }
            }
        }