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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -