Closed GoogleCodeExporter closed 9 years ago
Additionally, this technique actually fails with the same error:
string countNum = (from someRow in excel.WorksheetNoHeader(0)
select someRow[0]).First();
Trace.Write(countNum.ToString());
However, if I deliberately do:
string countNum = (from someRow in excel.WorksheetNoHeader("Steve's Data")
select someRow[0]).First();
Trace.Write(countNum.ToString());
It works correctly, so it seems that the issue has to do with the algorithm
that returns sheet-names. Hope this helps in the debugging process.
Original comment by steven.v...@gmail.com
on 14 Apr 2011 at 5:15
If you use the google code project at
http://code.google.com/p/excellibrary/
then the following can get sheet names...
public static List<string> getSheetNames(string strFilename)
{
Workbook book = Workbook.Load(strFilename);
List<string> sheetNames = new List<string>();
foreach (Worksheet sheet in book.Worksheets)
{
sheetNames.Add(sheet.Name);
}
return sheetNames;
}
The issue only occurs when someone is using the sheetnames from
GetWorksheetNames() or indexing with bad sheet names, so this is (at the least)
a workaround, or at most, a potential way of patching. Just figured I'd share
in case someone else is having the issue.
Original comment by steven.v...@gmail.com
on 19 Apr 2011 at 11:55
This issue is now fixed in version 1.5.1 You can either download it from NuGet
or from this site.
Original comment by paulyo...@gmail.com
on 21 Apr 2011 at 6:52
Original issue reported on code.google.com by
steven.v...@gmail.com
on 14 Apr 2011 at 6:21Attachments: