for (i = 1; i < dataGridView2.Columns.Count + 1; i++) { xlWorkSheet.Cells[1, i] = dataGridView2.Columns[i - 1].Name; } for (i = 0; i <= dataGridView2.RowCount - 1; i++) { for (j = 0; j <= dataGridView2.ColumnCount - 1; j++) { DataGridViewCell cell = dataGridView2[j, i]; xlWorkSheet.Cells[i + 1, j + 1] = cell.Value; } }
DataGridView2.Columns[i].HeaderText
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)