| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
9年前发布

使用LINQ语法查询Excel的.NET库:LinqToExcel

Linq to Excel 是一个 .Net 库能够让你使用LINQ语法来查询Excel电子表格。

Adding LinqToExcel to your project

NuGet

You can use NuGet to quickly add LinqToExcel to your project. Just search for linqtoexcel and install the package.

Manually Add References

If you don't want to use the NuGet package you can Download the latest files and add the following references to your project
* LinqToExcel.dll
* Remotion.Data.Linq.dll

x64 Support

If you want LinqToExcel to run in a 64 bit application, make sure to use the 64 bit version of the library.

You will also need to make sure to have the 64 bit version of the Access Database Engine installed on the computer.

Query a worksheet with a header row

The default query expects the first row to be the header row containing column names that match the property names on the generic class being used. It also expects the data to be in the worksheet named "Sheet1".

var excel = new ExcelQueryFactory("excelFileName");  var indianaCompanies = from c in excel.Worksheet<Company>()                         where c.State == "IN"                         select c;

Query a specific worksheet by name

Data from the worksheet named "Sheet1" is queried by default. To query a worksheet with a different name, pass the worksheet name in as an argument.

var excel = new ExcelQueryFactory("excelFileName");  var oldCompanies = from c in repo.Worksheet<Company>("US Companies") //worksheet name = 'US Companies'                     where c.LaunchDate < new DateTime(1900, 1, 1)                     select c;

项目主页:http://www.open-open.com/lib/view/home/1437535948631

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1437535948631.html
.NET开发 LinqToExcel