System.ArgumentOutOfRangeException

32 views
Skip to first unread message

Chris Given

unread,
Oct 8, 2019, 10:55:49 PM10/8/19
to CSVChat
I have a legacy project that uses csvreader to read a xls file auto generated by another system, it has been working for a long time however we recently started getting a ArgumentOutOfRangeException on .xls files that seem to open fine in Excel, OpenOffice, etc.

We tried downloading the latest demo version of csvreader and got the same error. I have no access to the system generating the .xls files.



var xr = new DataStreams.Xls.XlsReader("broken.xls");


An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll

Additional information: Index was out of range. Must be non-negative and less than the size of the collection.

shriop

unread,
Oct 8, 2019, 11:17:12 PM10/8/19
to CSVChat
Excel is very lenient in what it accepts, and there are a lot of technologies out there that produce files that Excel will open, that were not created by Excel. It's fairly easy to verify this by saving the file using Excel, and then verifying that it will then open up using DataStreams. Most likely it will.

My first suggestion is to open the file in Notepad and see if the file is actually a binary file, or is it HTML with a .xls file extension?

If that doesn't point you somewhere, and the file is a binary file, then is there a way that you can send me a failing file? I tend to expand the functionality in DataStreams to support odd files if the variance seems reasonable, but I would need to be able to recreate the issue and see exactly what is not loading from the file.

Bruce Dunwiddie
Reply all
Reply to author
Forward
0 new messages