C# 从内存流打开excel工作簿
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10957715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
open excel workbook from memorystream
提问by afkmaster
I am trying to open an excel workbook from a memorystream. I have a web url of the excel file, what I do is I download the data from the url, then save it into a memorystream, but I am not sure how to open the workbook from the stream, here is how my code works so far.
我正在尝试从内存流中打开一个 excel 工作簿。我有一个 excel 文件的 web url,我所做的是从 url 下载数据,然后将其保存到内存流中,但我不确定如何从流中打开工作簿,这是我的代码的工作原理远的。
WebClient wc = new WebClient();
byte[] fileArray = wc.DownloadData("url is inserted here");
MemoryStream ms = new MemoryStream(fileArray);
But from here I'm not sure how to go about reading the data from the stream to create the workbook, it doesn't seem like the spreadsheet document from http://msdn.microsoft.com/en-us/library/ff478410works the way I want it to, any assistance or pointers would be appreciated
但是从这里我不确定如何从流中读取数据以创建工作簿,它似乎不像来自http://msdn.microsoft.com/en-us/library/ff478410的电子表格文档以我想要的方式工作,任何帮助或指示将不胜感激

