Attributes.Sheet(StartRowIndex = 0) dont work
joylin1984 opened this issue · 4 comments
joylin1984 commented
net 4.5.2 WeihanLi.Npoi 1.3.7
Codes for test:
[WeihanLi.Npoi.Attributes.Sheet(StartRowIndex = 0)]
internal class MyClass
{
[WeihanLi.Npoi.Attributes.Column(Index = 0)]
public int id { get; set; }
[WeihanLi.Npoi.Attributes.Column(Index = 1)]
public string Name { get; set; }
[WeihanLi.Npoi.Attributes.Column(Index = 2)]
public double pp { get; set; }
[WeihanLi.Npoi.Attributes.Column(Index = 3)]
public DateTime year { get; set; } = DateTime.Now;
}
var res = ExcelHelper.ToEntityList<MyClass>("test1.xlsx", 0);
foreach (var r in res)
{
Console.WriteLine($"{r.id}---{r.Name}---{r.pp}---{r.year}");
}
Exception:
System.InvalidOperationException: Cannot get a text value from a numeric cell
joylin1984 commented
额,看了源码,HeaderRowIndex 最少为0,也就是必须要有行头~~~
是否可以增加无行头的设置呢?
WeihanLi commented
joylin1984 commented
nice, 1.3.8 version is work
WeihanLi commented
OK, thanks for the info