简体   繁体   English

ExcelDNA /托管XLL / Excel互操作

[英]ExcelDNA / Managed XLL / Excel Interop

I find it quite unbelieavble that the interop API is such a mess 我发现互操作API非常难以置信

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#? 有没有其他人经历过同样的事情,如果是这样,你用什么库来控制Exel从C#?

The obvious practical problem with the VSTO /COM Interop technology is the overhead incurred when transitioning between worksheet and managed code. VSTO / COM Interop技术的一个明显的实际问题是在工作表和托管代码之间转换时产生的开销。 (And if you're trying to talk to Excel without the help of VSTO, stop doing so and save yourself some huge headaches). (如果您在没有VSTO帮助的情况下尝试与Excel交谈,请停止这样做并避免一些巨大的麻烦)。 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. 我认为VSTO在托管环境中提供了一个与Excel对象模型密切相似的功能 - 当然我不需要花太多时间来尝试更多地了解.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. 对于运行时间较长的自动化活动而言,开销并不是一个问题,VBA自动化的类似问题也适用:尽可能减少跨接口的调用以获得最佳性能。

For smaller, faster worksheet function-type work (the sort of thing where we might write an XLL, say) that overhead can be a killer. 对于更小,更快的工作表函数类型的工作(我们可能写一个XLL的事情,比方说),开销可能是一个杀手。 ExcelDNA seems to be a great way into delivering managed code through the XLL model - and the price is right. ExcelDNA似乎是通过XLL模型提供托管代码的好方法 - 而且价格合适。

SpreadsheetGear for .NET is an Excel compatible spreadsheet component for .NET. SpreadsheetGear for .NET.NET的Excel兼容电子表格组件。 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. 不会让你控制Excel,但它会为你提供一个Excel兼容的ASP.NET / WinForms / etc电子表格引擎......可以创建,读取,修改,查看,编辑,格式化,计算,打印和编写Excel来自.NET的工作簿和图表。 Since SpreadsheetGear is 100% safe managed code, there is no per-call performance penalty like you get with Excel. 由于SpreadsheetGear是100%安全的托管代码,因此没有像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. SpreadsheetGear API与Excel的API非常相似 - 除了许多API的类型更强,因此它们更容易使用C#而不是Excel的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 . 你可以看到一个功能列表在这里 ,对于VB和C#现场ASP.NET报表/图表/仪表板/计算样品这里并下载免费试用这里

Disclaimer: I own SpreadsheetGear LLC 免责声明:我拥有SpreadsheetGear LLC

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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