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.

I have a limitation. i cannot use any thirdparty component. Any other idea?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.