linq - how to use ExcelColumn in LinqToExcel c#? -
i had added attributes model want xls file bind. like:
[excelcolumn("id")] public string id{ get; set; } but after need specify mapping anyway, because there no addmapping overload without arguments:
var excel = new excelqueryfactory(xlsxfilepath); excel.addmapping<xlsxfile>(x => x.id, "id"); is there way map using attributes, without x => x.id, "id" part? have found documentation, can't find https://github.com/paulyoder/linqtoexcel
ok, solution :)
public ienumerable<xlsxfile> import(string xlsxfilepath, string sheetname) {     using (var excel = new excelqueryfactory(xlsxfilepath))     {         return x in excel.worksheet<xlsxfile>(sheetname) x != null select x;     } } 
Comments
Post a Comment