SoftArtisans ExcelWriter在尝试打开xlsx文件时返回重复键错误

时间:2015-06-15 16:14:40

标签: c# excel officewriter

我们正在使用SoftArtisans ExcelWriter打开和处理来自各种excel文件的数据。最近有一个文件开始给我们以下错误: An item with the same key has already been added.

我已尝试使用Excel修复选项来修复文件并提取数据,但修复后的文件和原始文件都会继续返回相同的错误。

Stack Trace,正如所承诺的那样:

System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=An item with the same key has already been added.
Source=mscorlib
StackTrace:
   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 SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝜.ᜀ()
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝜..ctor(᜴ A_0, ᝉ A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.ᝂ.ᜀ()
   at SoftArtisans.OfficeWriter.ExcelWriter.Model.ᜉ..ctor(ល A_0, រ A_1, ᝣ A_2, ᡆ A_3)
   at SoftArtisans.OfficeWriter.ExcelWriter.Model.ល..ctor(ᝣ A_0, ᠐ A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.Model.ោ..ctor(ᝣ A_0, IEnumerable`1 A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝚..ctor(᜔ A_0, ᝘ A_1, ᝂ A_2, ឤ A_3)
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᝘.ᜄ()
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᜔.ᜀ()
   at SoftArtisans.OfficeWriter.ExcelWriter.XMLModel.᜔..ctor(Stream A_0, String A_1, ᝻ A_2)
   at SoftArtisans.OfficeWriter.ExcelWriter.ᜊ.ᜀ(Stream A_0, String A_1, Boolean A_2)
   at SoftArtisans.OfficeWriter.ExcelWriter.ᜊ.ᜀ(Stream A_0, Boolean A_1)
   at SoftArtisans.OfficeWriter.ExcelWriter.ExcelApplication.Open(Stream stream)

1 个答案:

答案 0 :(得分:0)

听起来像你或SoftArtisan的代码中有一个System.Collections.Generic.Dictionary,其中有两个具有相同键的对象被添加。