"Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index" when loading an .xlsb file from stream
My function:
public Stream ConvertToXlsx(Stream fileStream)
{
//Spire
using (var wb=new Workbook())
{
wb.LoadFromStream(fileStream); // <== this throws the exception
var stream = new MemoryStream();
wb.SaveToStream(stream,FileFormat.Version2016);
stream.Position = 0;
return stream;
}
}
StackTrace:
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.Collections.ArrayList.get_Item(Int32 index) +12711433
sprṎ.ᜀ(Int32 A_0) +60
sprℰ.ᜃ(StringBuilder A_0, Byte[] A_1, Int32 A_2) +212
sprℰ.ᜀ(Int32 A_0, Int32 A_1, Byte[] A_2, Int32 A_3, Int32 A_4, Boolean A_5) +4398
sprṍ.ᜍ() +62
spr⊴.ᜂ() +353
spr⊴.ᜀ(spr⊟ A_0, spr᪴ A_1) +214
spr⊬.ᜃ() +486
sprṮ.ᜀ(Stream A_0, sprḌ A_1, Boolean A_2) +743
sprṮ..ctor(Stream A_0, sprḌ A_1) +306
Spire.Xls.Core.Spreadsheet.XlsWorkbook..ctor(Object A_0, Stream A_1) +125
Spire.Xls.Workbook.LoadFromStream(Stream stream) +71
File that causes the error is an perfeclty valid spreadsheet, included in attachments