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
1750
Workbook.Load(filestream) throws System.ArgumentException
posted

 Hello!

 I am using the Infragistics Excel library to analyze excel files and deliver a reporting base.

I am using Infragistics in version 15.1.20151.2008. When loading some of the files I have for testing, I get the following exception: "System.ArgumentException - width and Height must be non-negative"

 StackTrace:

at System.Windows.Rect..ctor(Double x, Double y, Double width, Double height)     at Infragistics.Documents.Excel.Serialization.BiffRecordStream.ReadRect()     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.GroupShape.Load(WorkbookLoadManagerExcel2003 loadManager)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.EscherRecordBase.LoadRecord(WorkbookLoadManagerExcel2003 loadManager, EscherRecordContainerBase parentRecord)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.EscherRecordContainerBase.Load(WorkbookLoadManagerExcel2003 loadManager)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.ShapeContainer.Load(WorkbookLoadManagerExcel2003 loadManager)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.EscherRecordBase.LoadRecord(WorkbookLoadManagerExcel2003 loadManager, EscherRecordContainerBase parentRecord)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.EscherRecordContainerBase.Load(WorkbookLoadManagerExcel2003 loadManager)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.GroupContainer.Load(WorkbookLoadManagerExcel2003 loadManager)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.EscherRecordBase.LoadRecord(WorkbookLoadManagerExcel2003 loadManager, EscherRecordContainerBase parentRecord)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.EscherRecordContainerBase.Load(WorkbookLoadManagerExcel2003 loadManager)     at Infragistics.Documents.Excel.Serialization.BIFF8.EscherRecords.EscherRecordBase.LoadRecord(WorkbookLoadManagerExcel2003 loadManager, EscherRecordContainerBase parentRecord)     at Infragistics.Documents.Excel.Serialization.BIFF8.BiffRecords.MSODRAWINGRecord.Load(WorkbookLoadManagerExcel2003 loadManager)     at Infragistics.Documents.Excel.Serialization.WorkbookLoadManagerExcel2003.<>c__DisplayClass14.<LoadRecordHelper>b__12()     at Infragistics.Documents.Core.Async.If(Boolean condition, Func`1 statement, Func`1 elseStatement)     at Infragistics.Documents.Excel.Serialization.WorkbookLoadManagerExcel2003.LoadRecordHelper(Biff8RecordBase record)     at Infragistics.Documents.Excel.Serialization.WorkbookLoadManagerExcel2003.LoadCurrentRecord()     at Infragistics.Documents.Excel.Serialization.WorkbookLoadManagerExcel2003.LoadAllRecords()     at Infragistics.Documents.Excel.Serialization.WorkbookLoadManagerExcel2003.<LoadAllRecords>b__9()     at Infragistics.Documents.Core.WorkItem.WorkItemAsync.ExecuteCore(WorkItemScheduler scheduler)     at Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)  --- End of stack trace from previous location where exception was thrown ---     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()     at TryThrowExceptionDispatchInfo(Object )     at Infragistics.Documents.Core.WorkItem.ExceptionInfo.Rethrow()     at Infragistics.Documents.Core.WorkItem.RethrowIfExceptional()     at Infragistics.Documents.Core.WorkItem.RunNextWorkItem(WorkItemScheduler scheduler)     at Infragistics.Documents.Core.WorkItem.Execute(WorkItemScheduler scheduler)     at Infragistics.Documents.Core.WorkItemScheduler.SynchronousImpl.Execute(WorkItem workItem)     at Infragistics.Documents.Core.WorkItemExtensions.GetResult[TResult](WorkItem`1 this)     at Infragistics.Documents.Excel.Workbook.Load(Stream stream, WorkbookLoadOptions loadOptions)     at cmdIndexer.cmdIndexer.ComputeExcelFile()

 

The Excle file is loaded via 

Dim st As FileStream = New FileStream(cmdIndexer.exlFileData.strFilePath.ToString(), FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
book = Workbook.Load(st)

 I also have tried Workbook.Load(cmdIndexer.exlFileData.strFilePath.ToString()) but the error is thrown with this command.

The files are not opened by someone else when this error occurs. The error occurs only with *.xls files. Excel 2007 does not seem to make problems. The files are stored on a connected USB harddisk (during development) and on a network folder (in production)

Thank you for your help.

 
Parents Reply Children
No Data