I have a byte array of data in a MemoryStream and I’m trying to get Aspose.Cells to read it, but it keeps failing, even though with this same file a regular FileStream will work. I’ve attached the spreadsheet I’m using. The error that’s bubbling up is:
Cannot read that as a ZipFile
----> . : Bad signature (0xBDBFEFBD) at position 0x00001F1C
----> . : Bad signature (0xBDBFEFBD) at position 0x00001F1C
Code:
var data = File.OpenRead(“D:\temp\importtemp\1.import.xlsx”);
var sr = new StreamReader(data);
var encoding = new UTF8Encoding();
var bytes = encoding.GetBytes(sr.ReadToEnd());
var stream = new MemoryStream(bytes);
var worksheet = new Workbook(stream);