This project has moved and is read-only. For the latest updates, please go here.
/* taken from Tutorial07.csproj
The static class LateBindingApi.Core.Invoker is the low level interface from 
NetOffice to access a COM Server. This example shows you an example how to use it. See reference chapter4 in technical documentation for further info. */
private void Tutorial07Main() { // Initialize Api COMObject Support LateBindingApi.Core.Factory.Initialize(); Excel.Application application = new Excel.Application(); application.DisplayAlerts = false; application.Workbooks.Add(); Excel.Worksheet sheet = (Excel.Worksheet)application.Workbooks[1].Worksheets[1]; Excel.Range sampleRange = sheet.Cells[1, 1]; // we set the COMVariant ColorIndex from Font of ouer sample range
// with the invoker class
Invoker.PropertySet(sampleRange.Font, "ColorIndex", 1); // creates a native unmanaged ComProxy with the invoker object comProxy = Invoker.PropertyGet(application, "Workbooks"); Marshal.ReleaseComObject(comProxy); application.Quit(); application.Dispose(); MessageBox.Show(this, "Done!", this.Text, MessageBoxButtons.OK,
MessageBoxIcon.Information); }

Last edited Jan 5, 2012 at 10:48 AM by SebastianDotNet, version 5


No comments yet.