Saturday 16 February 2013

How to Export Data Table to Excel quickly?

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

You might also like:

Related Posts Plugin for WordPress, Blogger...