Quantcast
Channel: Excel Data Reader - Read Excel files in .NET
Viewing all articles
Browse latest Browse all 448

Commented Unassigned: ExcelReaderFactory.CreateBinaryReader fails [12992]

$
0
0
Pretty simple; code is as follows:

FileInfo thisfinfo = Utilities.GetFileInFolderByIndex(1, wipboardreports_folderpath);
FileStream stream = File.Open(thisfinfo.FullName, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);

Fails on line three.

Exception information:
OUTPUT:
"
...
...
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: An item with the same key has already been added.
"

CALL STACK:
"
Excel.4.5.dll!Excel.ExcelBinaryReader.readWorkBookGlobals() Line 244
Excel.4.5.dll!Excel.ExcelBinaryReader.Initialize(System.IO.Stream fileStream) Line 917
Excel.4.5.dll!Excel.ExcelReaderFactory.CreateBinaryReader(System.IO.Stream fileStream) Line 24
Project2.exe!MyTestSystem.Program.Main() Line 48 + 0x9 bytes

"


System information:
OS: Windows 7 64 bit
Compiler: Visual studio default?


Thanks to anyone for your help!
Comments: ** Comment from web user: Ian1971 **

It looks like it the spreadsheet may have a duplicated format record.

I recommend downloading the source code and checking the line it breaks on. A fix might be to add an additional line to first check that a index isn't already present in the the formats dictionary.

I don't have time to do this myself right now though.

Where did the xls come from?


Viewing all articles
Browse latest Browse all 448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>