Excel电子表格的自定义LINQ提供程序? [英] Custom LINQ provider for Excel spreadsheets?

查看:183
本文介绍了Excel电子表格的自定义LINQ提供程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道一个很好的自定义LINQ提供者来查询Excel电子表格中的数据?

解决方案

Linq to Excel 开源项目实现了一个简单直观的LINQ提供程序,用于从Excel电子表格获取数据。它负责在后台创建OLEDB连接和sql语句以及填充返回对象属性。



例如,下面的代码从excel读取数据,并返回一个用户对象的列表。它会自动将电子表格中的列名映射到类上的属性名称。

  var book = new ExcelQueryFactory(@C :\Users.xls); 
var administrators = from x in book.Worksheet< User>()
其中x.Role ==Administrator
select x;

结帐项目主页,并确保查看介绍视频


Does anyone know a good custom LINQ provider to query data from Excel spreadsheets?

解决方案

The Linq to Excel open source project implements a simple and intuitive LINQ provider for getting data from Excel spreadsheets. It takes care of creating the OLEDB connection and sql statement in the background as well as populating the return object properties.

For example, the code below reads the data from excel and returns a list of User objects. It automatically maps the column names in the spreadsheet to the property names on the class.

var book = new ExcelQueryFactory(@"C:\Users.xls");
var administrators = from x in book.Worksheet<User>()
                     where x.Role == "Administrator"
                     select x;

Checkout the project home page and be sure to view the introductory video.

这篇关于Excel电子表格的自定义LINQ提供程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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