Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Excel Library Exception, Negative Index
posted

Hi,

my company has buy the library version 18.2 but i have a problem when I select some excel file.

If I select the Excel file, whit dimension 17 K, i have an exception:

Index not in range. Request a value not negative and less than of dimension of the collection.\r\n Parameter name: index.

If I Open the Excel File and save it, the dimensione becomes 88 K and when i select the file, the code upload correctly all datas.

My code is:

String fileName = "Report_BilancioProvvisorio_20200612.xlsx";
Byte[] messageContent;
StreamReader readerStream = new StreamReader(fileName);
String messageContentTxt = readerStream.ReadToEnd();
readerStream.Close();
messageContent = System.Text.Encoding.UTF8.GetBytes(messageContentTxt);

byte[] fileByteList = File.ReadAllBytes(fileName);
MemoryStream mStream = new MemoryStream(fileByteList);

Workbook workbook;
try
{
workbook = Workbook.Load(mStream);
}
catch(Exception ex)
{
return;
}

My StackTace is:
in System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
in Infragistics.Documents.Excel.Serialization.Excel2007.FormatInfo.CreateWorksheetCellFormatData(WorkbookLoadManagerExcel2007 loadManager, Boolean isStyleFormat, Boolean forceApplyProperties)
in Infragistics.Documents.Excel.Serialization.Excel2007.XLSX.PartManagers.ObjectModelStylesPartManager.ParseFormatInfos(WorkbookLoadManagerExcel2007 loadManager, List`1 formatInfos)
in Infragistics.Documents.Excel.Serialization.Excel2007.XLSX.PartManagers.ObjectModelStylesPartManager.LoadStyleSheetEndElement(XmlPartManagerBase partManager)
in Infragistics.Documents.OfficeOpenXml.Core.XmlReadManager.LoadChildElementsHelper(Int32 startStackDepth, Int32 currentChildIndex, AlternateContentStatus alternateContentStatus, Boolean isContinuation, Boolean justPopped)
in Infragistics.Documents.OfficeOpenXml.Core.PartManagers.XmlPartManagerBase.<>c__DisplayClass31_0.<LoadCore>b__1()
in Infragistics.Documents.Core.Async.If(Boolean condition, Func`1 statement, Func`1 elseStatement)
in Infragistics.Documents.OfficeOpenXml.Core.PartManagers.XmlPartManagerBase.<LoadCore>b__31_0(XmlReader xmlReader)
in Infragistics.Documents.Core.Async.UsingHelper`1.<Execute>b__3_0()
in Infragistics.Documents.Core.Async.Try(Func`1 try, Action finally)
in Infragistics.Documents.Core.Async.UsingHelper`1.Execute()
in Infragistics.Documents.OfficeOpenXml.Core.PartManagers.XmlPartManagerBase.LoadCore()
in Infragistics.Documents.OfficeOpenXml.Core.PartManagers.XmlPartManagerBase.<Load>b__11_0()
in Infragistics.Documents.Core.Async.Try[TResult](Func`1 try, Action finally)
in Infragistics.Documents.OfficeOpenXml.Core.PartManagers.XmlPartManagerBase.Load()
in Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<>c__DisplayClass67_0.<LoadPart>b__3(Stream partStream)
in Infragistics.Documents.Core.Async.UsingHelper`1.<Execute>b__3_0()
in Infragistics.Documents.Core.Async.Try(Func`1 try, Action finally)
in Infragistics.Documents.Core.Async.UsingHelper`1.Execute()
in Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<>c__DisplayClass67_0.<LoadPart>b__2()
in Infragistics.Documents.Core.Async.Try(Func`1 try, Action finally)
in Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<>c__DisplayClass67_0.<LoadPart>b__1()
in Infragistics.Documents.Core.Async.If(Boolean condition, Func`1 statement, Func`1 elseStatement)
in Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<>c__DisplayClass67_0.<LoadPart>b__0(WorkItem`1 t)
in Infragistics.Documents.Core.WorkItemExtensions.<>c__DisplayClass8_0`1.<Then>b__0()
in Infragistics.Documents.Core.WorkItem.WorkItemAsync.ExecuteCore(WorkItemScheduler scheduler)
in Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in TryThrowExceptionDispatchInfo(Object )
in Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()
in Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)
in Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<>c__DisplayClass67_0.<LoadPart>b__0(WorkItem`1 t)
in Infragistics.Documents.Core.WorkItemExtensions.<>c__DisplayClass8_0`1.<Then>b__0()
in Infragistics.Documents.Core.WorkItem.WorkItemAsync.ExecuteCore(WorkItemScheduler scheduler)
in Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in TryThrowExceptionDispatchInfo(Object )
in Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()
in Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)
in Infragistics.Documents.OfficeOpenXml.Core.OfficeDocumentManager.<LoadCore>b__52_0(WorkItem`1 t)
in Infragistics.Documents.Core.WorkItemExtensions.<>c__DisplayClass8_0`1.<Then>b__0()
in Infragistics.Documents.Core.WorkItem.WorkItemAsync.ExecuteCore(WorkItemScheduler scheduler)
in Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in TryThrowExceptionDispatchInfo(Object )
in Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()
in Infragistics.Documents.Core.WorkItem.RunNextWorkItem(WorkItemScheduler scheduler)
in Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)
in Infragistics.Documents.Core.WorkItemScheduler.SynchronousImpl.Execute(WorkItem workItem)
in Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)
in Infragistics.Documents.Excel.Workbook.Load(Stream stream, WorkbookLoadOptions loadOptions)
in ConsoleApp6.Program.Main(String[] args) in C:\Users\User\source\repos\ConsoleApp6\ConsoleApp6\Program.cs:riga 33

Thank you

Parents Reply Children