I've got an ASP.NET project where I want to adopt LinqToExcel lib. For test purpose I created small class:
public class Point
{
[ExcelColumn("Stop ID")]
public int PointID{get;set;}
[ExcelColumn("Name")]
public string Name{get;set;}
[ExcelColumn("Elevation, meters")]
public float Elevation{get;set;}
}
I've got an excel file containing spreadsheet with data for those Points. I can retrieve them with:
var query1 = new ExcelQueryFactory(_pathExcelFile).WorksheetRange<Point> ("C2", "H10000", "Points");
foreach (var result in query1)
{
string name = result.Name;
}
And it works fine if data is correct in Excel. But if I change let's say Elevation value to any string data with chars(it is float in Point model) the code above is failed on foreach with 'Input string was not in a correct format' exception, and it is System.Format Exception. I need to handle this situation in a way to display informative message why parsing is failed with specific cell coordinates and value it contains. Exception doesn't contain this information. Any ideas how I can achieve this?