How to export data table to excel fast?
If we want to export datatable to excel worksheet cells quickly then use the following method
int col = 1, row = 1;
foreach (DataRow dr in Table.Rows)
{
foreach (object value in dr.ItemArray)
{
worksheet.Cell(row, col++).Value = value;
worksheet.Cell(row, col++).Value = dc.Caption;
}
row++;
col = fromCol;
}
No comments:
Post a Comment