Closed Ahmad-F123 closed 1 year ago
Can you provide example code that shows the issue?
var mapData = getMapData(); // return obj with indexvalue for Name, Title and Author also return HeaderRow
var excel = new ExcelMapper(@"......\products.xlsx");
excel.HeaderRow = mapData.HeaderRow; // issue happen if headerRow is true
excel.AddMapping
var books = excel.Fetch<Book>().ToList();
Can you show the class declarations for Book
and the class of the mapData
object?
public class Book { public string Name { get; set; } public string Title { get; set; } public string Author { get; set; }
}
public class mapData { public int Name { get; set; } public int Title { get; set; } public int Author { get; set; } public bool HeaderRow { get; set; }
}
If you're working with column indexes (not column names), then HeaderRow
should always be false. If you still want to skip the first row when reading data, set MinRowNumber
to 1.
I try with headerRow false, working fine but when headerRow is true, data will get empty