读取内存中的Excel文件(字节数组)使用ADO.NET? [英] Read an in-memory Excel file (byte array) with ADO.NET?

查看:124
本文介绍了读取内存中的Excel文件(字节数组)使用ADO.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用ADO.net从Excel文件中提取一些数据。这个过程是pretty的有据可查的在互联网上。我的缺点是,我的文件已被网友上传,因此只存在在内存中的字节数组。出于安全和性能的原因,我宁可不要将此文件写入磁盘。

I want to use ADO.net to extract some data from an Excel file. This process is pretty well documented on the internet. My catch is that my file has been uploaded by a user, and so exists only as a byte array in memory. For security and performance reasons I would rather not write this file to disk.

有构造连接到一个字节数组的连接字符串的方法是什么?或许暴露了数组实际存储在内存中(如RAM磁盘我猜)的文件?

Is there a way of constructing a connection string that connects to a byte array? Or perhaps exposing that array as a file that is actually stored in memory (like a RAM disk I guess)?

推荐答案

您无法连接,如果只存在于内存中。 OLE也排除了(虽然使用办公自动化服务器应用程序是设计不良开始)。

You can't connect if it only exists in memory. OLE is also ruled out (though using Office Automation for a server application is poor design to begin with).

我能想到的唯一的办法就是亲自读取二进制Excel数据 - 例如将S preadSheetGear.Net的东西,如:

The only way I can think of is to read the binary Excel data yourself - for example use SpreadSheetGear.Net with something like:

SpreadsheetGear.Factory.GetWorkbookSet().Workbooks.OpenFromStream(*stream*);

这篇关于读取内存中的Excel文件(字节数组)使用ADO.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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