Help! Saving new XlsIo Excel 2007 Spreadsheet

This C# code using XlsIo version 6.403.0.15 in .NET 3.5:

this.engine = new ExcelEngine();
this.application = engine.Excel;
this.application.DefaultVersion = ExcelVersion.Excel2007;
this.workBook = engine.Excel.Workbooks.Add(ExcelVersion.Excel2007);
this.workBook.Worksheets[0][1, 1].Text = "Hello";
this.workBook.SaveAs(filename);
this.workBook.Save(); <<-- Exception thrown here.

Causes this exception:

System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveArchiveItemRelationContentType(String partName, String contentType, String relationType)
at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveDocumentProperties()
at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveDocument()
at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.SaveDocument(String filename)
at Syncfusion.XlsIO.Implementation.XmlSerialization.FileDataHolder.Serialize(String fullName, WorkbookImpl book, ExcelSaveType saveType)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName, ExcelSaveType saveType, ExcelVersion version)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.SaveAs(String FileName)
at Syncfusion.XlsIO.Implementation.WorkbookImpl.Save()

Any ideas on what I'm doing wrong?

Everything works fine with 97-2003 Excel version but I'm creating a spreadsheet that has over 65,536 rows and need to use the 2007 Excel version.

As many are I'm on a tight project deadline and would appreciate any help.




2 Replies

BO Brian O'Neil May 19, 2011 04:53 PM UTC

I did download the trial of the latest version of the XlsIo components and the code works fine.

Would still like to know if there is a way to make the older version work.




SR Sridhar Syncfusion Team May 20, 2011 04:17 AM UTC

Hi Brain,

Thank you very much for using Syncfusion products.

The version 6.4 is almost 3 years old and we have issued about 11 major releases from that time. From a technical perspective, it would be a difficult task to migrate to the lowest version. We would therefore urge you to upgrade. We will also help you with migration issues if any.

Please let us know if you require any further clarifications.

Regards,
Sridhar.S




Loader.
Up arrow icon