简体   繁体   中英

open excel workbook from memorystream

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.

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/ff478410 works the way I want it to, any assistance or pointers would be appreciated

SpreadSheetDocument有一个Open静态方法重载,它将流作为文档源的参数,只需添加到您的代码中:

var doc = SpreadSheetDocument.Open(ms, isEditable);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM