-
Notifications
You must be signed in to change notification settings - Fork 6
30 Use anotations to read table without title
René Pacios edited this page Sep 5, 2019
·
3 revisions
We can used DataAnnotations to refer columns without titles, in this case we have to use builtin custom annotation ColumnName
For Example, for this Excel Table:

We have to modify VO class like that
public class SimpleTable
{
[ColumnName("B")]
public int Number { get; set; }
[ColumnName("C")]
public string Name { get; set; }
[ColumnName("D")]
public DateTime ADate { get; set; }
}Don't forget indicate to library that first row isn't a title in ReadOptions
var data = wb.ReadTable<SimpleTable>(1,
new ReadOptions()
{
TitlesInFirstRow = false
});