Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue May 16, 2017 5:54 pm

When trying to open certain workbook I am getting the exception "An item with the same key has already been added." with the StackTrace
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Spire.Xls.Core.Spreadsheet.XmlReaders.Shapes.ShapeParser.SplitStyle(String styleValue)...(the rest is decompiled nonsense methods)
even after catching this exception, what i am guessing is a background thread throws an exception that goes uncaught and kills the application. "An unhandled exception of type 'System.NullReferenceException' occurred in Spire.XLS.dll" no stack trace at that point.
The code i am using is the simple
Workbook book = new Workbook();
book.LoadFromFile(attachment);
book.SaveToFile(pdfAttachment, FileFormat.PDF);

It is breaking on LoadFromFile...this works for most workbooks i have tried, but is failing on this workbook and a few others, this workbook can be opened with another API we are using and opens without exception in Excel. The book contains 5 pages 1 has a table with data in it (actually made up of 2 ranges but the table spans them), 1 page is just simple data, 1 page is a pivot table based on the data in the second sheet, 1 page is just data that is used as variables during execution, and the last page is just some simple data used for information. Any idea what would cause this issue when loading the book and why there is a following unhandled exception that isn't caught by the surrounding try{}catch{} block and kills the program?

cpheffelfinger
 
Posts: 5
Joined: Mon May 15, 2017 1:51 pm

Tue May 16, 2017 6:33 pm

The issue was fixed by installing the hotfix 7.12

cpheffelfinger
 
Posts: 5
Joined: Mon May 15, 2017 1:51 pm

Wed May 17, 2017 1:36 am

Dear cpheffelfinger,

Glad to hear that the issue was fixed.
Please feel free to contact us if you have any question.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Oct 30, 2020 2:35 pm

Hi ,

I get the following exception when trying to invoke the
workbook.SaveToStream
method after accessing the
Range["Address"].FormulaStringValue
property of a worksheet :

an item with the same key has already been added. key: sprᣕ'"

bcx_exa.2020
 
Posts: 5
Joined: Thu Oct 15, 2020 7:59 am

Mon Nov 02, 2020 2:01 am

Hello bcx_exa.2020,

Thanks for your inquiry.
I tested your scenario with the latest Spire.XLS Pack(Hotfix) Version:10.10.6 but did not reproduce your issue. To help us investigate further, please provide your source Excel file and your complete test code. You could upload your file here or send it to us (support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon Nov 16, 2020 3:46 am

Hello bcx_exa.2020,

How is your issue now? Could you please give us some feedback at your convenience?

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.XLS