public void Run() { /* * NetOffice provides features to compare 2 proxies directly on server. * * 2 proxies may different instances but pointing to the same instance on the com server(the office application) * * This is a showstopper to demonstrate a deep comparison. * * ------------------------------------------------------- * Former NetOffice versions spend operator overloads here. * This is impossible in NetOffice 2.0 and above because * NetOffice 2.0 use interfaces instead of classes. * */ using (var application = COMObject.Create <Excel.Application>()) { application.DisplayAlerts = false; Excel.Workbook book = application.Workbooks.Add(); bool isEqual = false; // determine active workbook is the same as book1 on the server isEqual = application.ActiveWorkbook.EqualsOnServer(book); // another static version to do the same isEqual = COMObject.EqualsOnServer(application.ActiveWorkbook, book); application.Quit(); } HostApplication.ShowFinishDialog(); }
private bool Equal(object applicationProxyA, object applicationProxyB) { try { COMObject a = new COMObject(applicationProxyA); COMObject b = new COMObject(applicationProxyB); return(a.EqualsOnServer(b)); } catch (Exception) { throw; } }
private bool Equal(object applicationProxyA, object applicationProxyB) { try { COMObject a = new COMObject(applicationProxyA); COMObject b = new COMObject(applicationProxyB); return a.EqualsOnServer(b); } catch (Exception) { throw; } }