Excel自动化或ADO.NET用于处理excel文件? [英] Excel automation or ADO.NET for handling with excel files?

查看:105
本文介绍了Excel自动化或ADO.NET用于处理excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道除了处理Excel文件的第三方和开放源代码外,我们还有2种标准方法, Excel自动化(Microsoft.Office.Interop.Excel.dll)或 ADO.NET 与OLE DB数据库提供程序。但是我不知道何时使用这个或那个,我认为使用自动化总是让我对excel文件处理有更多的控制,但在某些情况下,自动化不是必需的,而ADO.NET可以提供帮助。



我不知道ADO.NET可以为我处理Excel文件。如果可能的话,你可以就这个问题给我一些想法。示例和外部链接可以提供帮助。另外两个之间的缩写比较还可以。





谢谢。

I know that except third-party and open sources for handling with Excel files, we have 2 standard methods to do, Excel automation (Microsoft.Office.Interop.Excel.dll) or ADO.NET with OLE DB database provider. However I don''t know when to use this or that, I think using automation always brings me more controls over the excel files handling, but in some case automation is not necessary while ADO.NET can help.

I don''t know what ADO.NET can do for me with handling with Excel files. If possible could you give me some idea on this problem. Examples and external links can help. Also an abbreviated comparison between two of these is OK.


Thanks.

推荐答案

这取决于你需要什么。但这里有一个非常简约的比较:

- ADO会将Excel文件视为数据源(没有可用的格式),但它不是资源节省

- 互操作你获得完全控制,但你将在后台运行Excel实例,因此资源昂贵;它只能在单一访问情况下使用(不能在asp.net应用程序中使用它)
It depends on what you need. But here is a really minimalistic comparison:
- ADO will treat an Excel file as data source (no formatting available), but it is not resource saving
- with interop you get full control, but you will have running Excel instances in the background, thus it is resource expensive; and it is merely usable in single-access situations (can''t really use it in an asp.net application)


这可能会对你有所帮助 - > http://bytes.com/topic/c-sharp/answers/ 254784-excel-automation-vs-ado-net [ ^ ]
This might help you -> http://bytes.com/topic/c-sharp/answers/254784-excel-automation-vs-ado-net[^]


如果您想在Excel中使用ADO.NET,请点击以下链接:

如何使用ADO.NET使用Visual Basic .NET在Excel工作簿中检索和修改记录 [ ^ ] - 知道,它的VB.NET,但包含许多有用的信息。

使用ADO.NET处理Excel文件 [ ^ ]

在ASP中导入/导出Excel工作表。 NET(CSASPNETExcelImportExport) [ ^ ]





Interop:

如何:使用COM Interop创建Excel电子表格(C#编程指南) [ ^ ]

Excel对象模型概述 [ ^ ]
In case you''ll ever want to use ADO.NET with Excel, follow below links:
How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET[^] - know, its VB.NET, but contains many useful information.
Using ADO.NET to work with Excel files[^]
Import/export Excel worksheet in ASP.NET (CSASPNETExcelImportExport)[^]


Interop:
How to: Use COM Interop to Create an Excel Spreadsheet (C# Programming Guide)[^]
Excel Object Model Overview[^]


这篇关于Excel自动化或ADO.NET用于处理excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆