简体   繁体   English

是否有用于MS Excel操作(读/写)的Dot NET(C#)库?

[英]Is there a Dot NET (C#) library for MS Excel operations (read/write)?

I'm coding a library from scratch and was wondering if one already exists. 我正在从头开始编码一个库,想知道是否已经存在。

I need to perform the following operations: 我需要执行以下操作:
- Read all sheets from all excel files in a specified folder and place them in a data set (each sheet from each file in a different data table. And each excel sheet in a different data set) -从指定文件夹中的所有excel文件中读取所有工作表,并将它们放置在数据集中(每个文件中的每个工作表都在不同的数据表中。每个excel工作表都在不同的数据集中)
- A quick efficient way to write one data table to a new excel file in one excel sheet. -一种快速有效的方法,可将一个数据表写入一个Excel工作表中的新Excel文件。 - Works on xls and xlsx files. -适用于xls和xlsx文件。

A link to an open source library would be really helpful. 链接到开源库将非常有帮助。

它不是开源的,但我通常会使用Microsoft的Open XML SDK 2.0来执行此类工作。

as an alternative to the component you can query a spreadsheet as a "classic" datasource like Sql Server. 作为该组件的替代方案,您可以查询电子表格作为“经典”数据源,例如Sql Server。 Create a connection string pointing to the path of your file and use the Microsoft.jet.oledb.4.0 provider (it is not available on x64 os, in that case you will have to use third party component to establish the connection). 创建一个指向文件路径的连接字符串,并使用Microsoft.jet.oledb.4.0提供程序(在x64 os上不可用,在这种情况下,您将必须使用第三方组件来建立连接)。 Once this is done you can run sql statements over your .xls . 完成此操作后,您可以在.xls上运行sql语句。

Here you can find some useful infos : hhttp://www.davidhayden.com/blog/dave/archive/2006/05/26/2973.aspx 在这里您可以找到一些有用的信息:hhttp://www.davidhayden.com/blog/dave/archive/2006/05/26/2973.aspx

Aspose.Cells is a good library for handling Excel files. Aspose.Cells是用于处理Excel文件的良好库。

However, it is not open source. 但是,它不是开源的。

I have yet to find a good library that is open source for this. 我还没有找到一个好的开源库。

Take a look at EPPlus: Codeplex . 看看EPPlus: Codeplex Note that it only works with .xlsx, is that a problem, or could it work? 请注意,它仅适用于.xlsx,是否有问题,或者可以使用?

我正在使用此代码读取excel文件(.xls二进制文件) http://www.codeproject.com/KB/office/Excel_DataReader.aspx

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

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