This project has moved. For the latest updates, please go here.
/* taken from Tutorial05.csproj
COMObject is the common base type for all objects in NetOffice which are based on 
CoClasses or Interfaces and also the type for anonymous COM Proxies at design time.
This example shows you how to use. See chapter1 and chapter2 in technical documentation for further info. */
private void Tutorial05Main() { // Initialize Api COMObject Support LateBindingApi.Core.Factory.Initialize(); // start application Excel.Application application = new Excel.Application(); application.DisplayAlerts = false; // create new Workbook Excel.Workbook book = application.Workbooks.Add(); // ActiveSheet is defined as unkown Proxy in Excel Type Library, it can
// have multiple types at runtime
but its always a COM Proxy, never a
// scalar type like bool or int.
In VBA oder PIA its converted to object,
// in NetOffice its represents as COMObject
// All NetOffice classes inherited COMObject COMObject sheet = application.ActiveSheet; if (sheet is Excel.Worksheet) { Excel.Worksheet activeSheet = (Excel.Worksheet)sheet; } // 3 basic properties of COMObject object proxy = sheet.UnderlyingObject; string proxyClassName = sheet.UnderlyingTypeName; bool isDisposed = sheet.IsDisposed; application.Quit(); application.Dispose(); MessageBox.Show(this, "Done!", this.Text, MessageBoxButtons.OK,
MessageBoxIcon.Information); }

  
   See next: Tutorial06 - Understand Variant Type

Last edited Mar 12, 2012 at 3:42 PM by SebastianDotNet, version 10

Comments

No comments yet.