简体   繁体   中英

Is it possible to write ActiveX Controls in C# that will run in Excel?

I have been searching on the web for some example code on how we can write a custom ActiveX Control for use in Excel using .NET but so far I have found old articles suggesting that it is not supported.

The application we are building uses Excel as a report writer so we which to add some custom controls to the worksheets to provide a richer experience. From the research I have done so far it appears that some ActiveX Controls can only be hosted in IE and hence I need to ensure that any approach taken works with Excel as a host.

The link http://www.codeproject.com/KB/miscctrl/exposingdotnetcontrols.aspx mentions the following:

CAVEAT : As this support has been dropped from Beta2 of .NET, don't blame me if it fries your PC or toasts the cat.

Can anybody give me an indication if it is possible using .NET 1.1 and if so to any pointers on best practices?

Andrew Whitechapel writes about managed controls as ActiveX controls in Office documents. You can read his article here:

Using Managed Controls as ActiveX Controls

I would thought that you're out of luck, but did find this:

http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx

Gives me the willies... but it might just right for you.

Further information on creating ActiveX Controls using C# can be found below although these articles seem to use IE as a Hosting Container not Excel.

http://www.ondotnet.com/pub/a/dotnet/2003/01/20/winformshosting.html

http://www.codeproject.com/KB/miscctrl/exposingdotnetcontrols.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM