Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / October 2005

Tip: Looking for answers? Try searching our database.

Excel COM Wrapper in C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ps - 15 Oct 2005 14:09 GMT
In OLE/COM Object Viewer, I found Excel Interface _Worksheet like this.

[uuid(000208D8-0000-0000-C000-000000000046)]
[helpcontext(0x00020010), dual, nonextensible]
dispinterface _Worksheet
{
    //   :
    //   :
[id(0x000000c5), propget, helpcontext(0x000100c5)]
Range* Range([in] VARIANT Cell1, [in, optional] VARIANT Cell2);
    //   :
    //   :
}

In C#, I rewrite the above code like this.

[ComImport, Guid("00020820-0000-0000-C000-000000000046")]
public class WorksheetClass{}

[ComImport, CoClass(typeof(WorksheetClass))]
[Guid("000208D8-0000-0000-C000-000000000046")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface Worksheet
{
    //    :
    //    :
    Range Range(object Cell1, object Cell2);
    //    :
    //    :
}

but Error...

*******************************************************************
An unhandled exception of type
   'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Additional information: Member not found.
*******************************************************************

How Can I .....?
Willy Denoyette [MVP] - 17 Oct 2005 10:44 GMT
> In OLE/COM Object Viewer, I found Excel Interface _Worksheet like this.
>
[quoted text clipped - 36 lines]
>
> How Can I .....?

Not sure why you defining this yourself. Why not use the Office primary
interop assemblies (PIA's)?

Willy.
Uday Takbhate [MSFT] - 19 Oct 2005 20:30 GMT
Office Primary Interop Assemblies
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/h
tml/wrrefofficeprimaryinteropassemblies.asp

Office 2003 Update: Redistributable Primary Interop Assemblies
http://www.microsoft.com/downloads/details.aspx?FamilyId=3C9A983A-AC14-4125-
8BA0-D36D67E0F4AD&displaylang=en

Hope this is helpful!

Uday Takbhate [MSFT]
--------------------
>From: "Willy Denoyette [MVP]" <willy.denoyette@telenet.be>
>References: <#Mlh6mY0FHA.1924@TK2MSFTNGP14.phx.gbl>
[quoted text clipped - 58 lines]
>
>Willy.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.