从流中读取excel文件 [英] Read excel file from a stream

查看:189
本文介绍了从流中读取excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种从流中读取Excel文件的方法。它似乎不适用于ADO.NET的做事方式。



这种情况是用户通过FileUpload上传文件,我需要阅读一些值从文件导入到数据库。



由于几个原因,我不能将文件保存到磁盘,没有任何理由所以,有人知道从FileUpload流中读取Excel文件的方式吗?



http://www.codeplex.com/ExcelDataReader



这个图书馆似乎工作得很好,它需要一个流读取excel文件。

  ExcelDataReader reader = new ExcelDataReader(ExcelFileUpload.PostedFile.InputStream); 


I need a way to read a Excel file from a stream. It doesn't seem to work with the ADO.NET way of doing things.

The scenario is that a user uploads a file through a FileUpload and i need to read some values from the file and import to a database.

For several reasons I can't save the file to disk, and there is no reason to do so either.

So, anyone know of a way to read a Excel file from a FileUpload stream?

解决方案

It seems i found a soultion to the problem myself.

http://www.codeplex.com/ExcelDataReader

This library seems to work nicely and it takes a stream to read the excel file.

ExcelDataReader reader = new ExcelDataReader(ExcelFileUpload.PostedFile.InputStream);

这篇关于从流中读取excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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