We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Spreadsheet wont open excel file with throwing an exception

Thread ID:

Created:

Updated:

Platform:

Replies:

141595 Dec 19,2018 05:00 PM UTC Dec 26,2018 07:28 AM UTC WinForms 6
loading
Tags: Spreadsheet
Spotty
Asked On December 19, 2018 05:00 PM UTC

Trying to open an existing excel spreadsheet in the spreadsheet control results in the following exception.

System.Reflection.TargetInvocationException
  HResult=0x80131604
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at ExcelDisplay.My.MyApplication.Main(String[] Args) in :line 81

Inner Exception 1:
ArgumentException: Item has already been added. Key in dictionary: '!3!'  Key being added: '!3!'



I'm able to open other simple spreadsheets but this one wont open in the control but opens in excel with no problem.

Super simple call - Spreadsheet3.Open("C:\Users\skytr\Source\Repos\ExcelDisplay\ExcelDisplay\bin\Debug\CheckInModified.xlsx")




Arulraj A [Syncfusion]
Replied On December 20, 2018 07:12 AM UTC

Hi Spotty, 

Thanks for using Syncfusion product. 

We have tried your reported scenario in our latest version 16.4.0.42 but all the .xlsx files are opened properly. So, if it is possible please provide the mentioned excel file(CheckInModified.xlsx) it will be helpful us to address your reported scenario at the earliest. 


Arulraj A 


Spotty
Replied On December 21, 2018 03:46 PM UTC

Heres an example file

Attachment: CheckinModified_9f8a9f68.zip

Spotty
Replied On December 23, 2018 01:24 AM UTC

I believe this has something to do with data validation in the spreadsheet.

At the moment this makes the control unusable for the variety of spreadsheets I have to load as all of them use data validation in Excel.


Arulraj A [Syncfusion]
Replied On December 24, 2018 06:27 AM UTC

Hi Spotty, 
 
Thanks for your update. 

We have tried to test by importing your provided spreadsheet using below attached sample but the sample is working fine as we expected. Also, in your provided excel file “PPW & PYMT DONE”  column has a validation which is also working fine in our Spreadsheet control. So, please let us know the following details, 
  • Please provide your current Syncfusion product version details.
  • Let us know your exact use case to reproduce your reported scenario.
  • In your provided stack trace, there is no Syncfusion source found so we are unable to check the possibilities to analyze on our source. So, please provide more details to reproduce your reported scenario.
  • Let us know the below attached sample differ from your customization it will be helpful us to analyze further.


Please let us know if you have any concerns. 

Arulraj A 


Spotty
Replied On December 24, 2018 04:15 PM UTC

Here are two files.

I believe I am using winforms version 16.3460.0.21 and Runtime Versuin v4.0.30319

Added the 2 spreadsheets to a form and added a button with the following.

    Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
        Try
            TestSpreadsheet.Open("C:\Test\spread1.xlsx")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Try
            Spreadsheet2.Open("C:\Test\spread2.xlsx")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

Spreadsheet1 results in

System.Reflection.TargetInvocationException
  HResult=0x80131604
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at ExcelDisplay.My.MyApplication.Main(String[] Args) in :line 81



Spread2 results in

System.Reflection.TargetInvocationException
  HResult=0x80131604
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at ExcelDisplay.My.MyApplication.Main(String[] Args) in :line 81

Inner Exception 1:
ArgumentException: Item has already been added. Key in dictionary: '!4!'  Key being added: '!4!'



Even changing the file to use in your example throws an exception for Spread1.




Attachment: Spreads_d1ba4569.zip

Jagadeesan Pichaimuthu [Syncfusion]
Replied On December 26, 2018 07:28 AM UTC

  
Hi Spotty, 
 
Thanks for your update. 
 
Query 
Response 
Spreadsheet1 results in 
System.Reflection.TargetInvocationException 
  HResult=0x80131604 
  Message=Exception has been thrown by the target of an invocation. 
We can reproduce this reported scenario and we have confirmed this is a bug. So, we have logged the bug report for this issue “Null reference exception occurred when use the GraphicsCell and FrozenRows”. This fix will be available on our next release 2018 Volume4 SP1 which will be expected at mid of February.  
Spread2 results in 
 
System.Reflection.TargetInvocationException 
  HResult=0x80131604 
  Message=Exception has been thrown by the target of an invocation. 
 
We have tried to reproduce your reported scenario using your provided “Spread2.xlsx” excel file. We did not get any exception “Item has already been added. Key in dictionary: '!4!'  Key being added: '!4!'” as you mentioned. Please refer the below tested sample and let us know the below attached sample differ from your customization. It will be helpful us to assist you further. 
 
 
 
 
Regards, 
Jagadeesan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;