I'm using LoadXls to upload a file from a stream and I get the following error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at External.CompoundFile.ReadData.(BinaryReader , ArrayList& )
at External.CompoundFile.ReadData..ctor(Ole2CompoundFile , Stream )
at External.CompoundFile.Ole2CompoundFile.Load(Stream , Boolean )
at GemBox.Spreadsheet.XlsLoadOptions.(Stream , Boolean , Byte[]& , Byte[]& , Boolean , Byte[]& , Byte[]& , Ole2Storage& )
at GemBox.Spreadsheet.XlsLoadOptions.(ExcelFile , Stream )
at GemBox.Spreadsheet.LoadOptions.(ExcelFile , Stream , String )
at GemBox.Spreadsheet.LoadOptions.(ExcelFile , Stream , String , Boolean )
at GemBox.Spreadsheet.ExcelFile.LoadXls(Stream stream)
I'm using GemBox.SpreadSheet.dll version 41.3.30.1047 (free license).
What could be wrong with the stream? It's a MemoryStream I create by obtaining the stream directly from a cloud storage service (AWS S3, Bluemix, Google Cloud Storage, Azure).
Here is the xls I'm trying to load
Solution: The solution ended up being setting the MemoryStream's position to beginning before reading it.