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

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

问题描述

有谁知道一个良好的自定义LINQ提供程序从Excel电子表格中查询数据?

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

推荐答案

LINQ到Excel中的开源项目实现了从Excel电子表格中获取数据的简单而直观的LINQ提供程序。这需要建立在后台OLEDB连接和SQL语句以及填充返回对象属性的照顾。

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.

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

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;



在结账的项目主页并务必查看介绍视频

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

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