Simple way to Export DataGridView to Excel
问题 I am trying to copy DataGridView data to Excel and I am using this code: public static void ExportToExcel(DataGridView dgView) { Microsoft.Office.Interop.Excel.Application excelApp = null; try { // instantiating the excel application class object misValue = System.Reflection.Missing.Value; excelApp = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook currentWorkbook = excelApp.Workbooks.Add(Type.Missing); Microsoft.Office.Interop.Excel.Worksheet