Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Winform Exporting Data to Excel form Datagridview
How can i optimize the perfomance of exporting data from datagridview with
500 rows of data to excel? I've added reference to Microsoft Excel 11.0 object library. It's taking 3-4 minutes to export 500 rows. below is the code, which i wrote: Excel.ApplicationClass excelApp = new Excel.ApplicationClass(); int ColumnIndex = 0; foreach (DataGridViewColumn col in dgv.Columns) { ColumnIndex++; excelApp.Cells[1, ColumnIndex] = col.HeaderText; } int rowIndex = 0; foreach (DataGridViewRow row in dgv.Rows) { rowIndex++; //ColumnIndex = 0; for (int colIndex = 1; colIndex < dgv.Columns.Count; colIndex++)// (DataGridViewColumn genCol in dgv.Columns) { //ColumnIndex++; excelApp.Cells[rowIndex + 1, colIndex] = row.Cells[colIndex].Value; } } Would appriciate any good suggetions or help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exporting excel charts with form controls (spinner) to Powerpoint | Charts and Charting in Excel | |||
Embedding Excel in a C# WinForm | Excel Programming | |||
excel in winform | Excel Programming | |||
Exporting Data from Excel Form to HTML Page | Excel Programming | |||
exporting data from a form to a spread sheet | Excel Programming |