简体   繁体   中英

ExcelDNA / Managed XLL / Excel Interop

I find it quite unbelieavble that the interop API is such a mess

A lot of methods have no comments on and seems to have been done very poorly

Has anyone else experienced the same and if so what library do you use to control Exel from C#?

The obvious practical problem with the VSTO /COM Interop technology is the overhead incurred when transitioning between worksheet and managed code. (And if you're trying to talk to Excel without the help of VSTO, stop doing so and save yourself some huge headaches). I thought VSTO did a pretty good job of providing a close analog of the Excel object model in the managed environment - certainly I didn't need to spend much time trying to understand much more about .NET Interop.

For longer-running automation activities the overhead's not so much of a problem, similar concerns to VBA automation apply: reduce calls across the interface as far as possible to get best performance.

For smaller, faster worksheet function-type work (the sort of thing where we might write an XLL, say) that overhead can be a killer. ExcelDNA seems to be a great way into delivering managed code through the XLL model - and the price is right.

SpreadsheetGear for .NET is an Excel compatible spreadsheet component for .NET. It will not enable you to control Excel, but it will give you an Excel compatible spreadsheet engine for ASP.NET / WinForms / etc... that can create, read, modify, view, edit, format, calculate, print and write Excel workbooks and charts from .NET. Since SpreadsheetGear is 100% safe managed code, there is no per-call performance penalty like you get with Excel.

The SpreadsheetGear API is very similar to Excel's API - except for the fact that many APIs are more strongly typed so they tend to be easier to use from C# than Excel's API.

You can see a feature list here , live ASP.NET reporting / charting / dashboard / calculation samples for VB and C# here and download the free trial here .

Disclaimer: I own SpreadsheetGear LLC

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