Hi @sblb ,
I finally found out where the problem was.
In this code your tbody
has wrong tag:
<tboby>
@foreach(DataRow row in dt.Rows)
{
<tr>
@foreach(DataColumn col in dt.Columns)
{
<td>@row[col.ColumnName].ToString()</td>
}
</tr>
}
</tboby>
Changing <tboby></tboby>
to <tbody></tbody>
fixes this.
In addition, the null reference exception you had before was caused by a for loop exception.
for(var j=0; j <= cc; j++)
{
ICell cell = hr.GetCell(j);
dt.Columns.Add(cell.ToString());
}
j
cannot be equal to cc
, this would go out of the scope of the loop. It should be:
for(var j=0; j < cc; j++)
You can have a try.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Chen Li