hi,

I want to export data to Excel from Dataset and DataGrid and format the output excel file like "Auto Fit" for coulns, Bold headers and also control the Cells.

Please dont suggest using Interop Calls.
I understand that we can use the RenderControl to write to the htmltextwriter so may be someone can enhance on this.


I need the .NET equivalent.

hi,

I want to export data to Excel from Dataset and DataGrid and format the output excel file like "Auto Fit" for coulns, Bold headers and also control the Cells.

Please dont suggest using Interop Calls.
I understand that we can use the RenderControl to write to the htmltextwriter so may be someone can enhance on this.


I need the .NET equivalent.

you can export from datagridview to excel

For i = 0 To DataGridView1.RowCount - 2
For j = 0 To DataGridView1.ColumnCount - 1
xlWorkSheet.Cells(i + 1, j + 1) = _
DataGridView1(j, i).Value.ToString()
Next
Next


follow this :

http://vb.net-informations.com/excel-2007/vb.net_export_from_datagridview_to_excel.htm

This article has been dead for over six months. Start a new discussion instead.