Export Gridview to Excel with EPPLus
问题 I am trying to export data from datatable to Excel file using EPPlus, but nothing seems to work. This is the code- using (ExcelPackage xp = new ExcelPackage()) { ExcelWorksheet ws = xp.Workbook.Worksheets.Add(dt.TableName); int rowstart = 2; int colstart = 2; int rowend = rowstart; int colend = colstart + dt.Columns.Count; ws.Cells[rowstart, colstart, rowend, colend].Merge = true; ws.Cells[rowstart, colstart, rowend, colend].Value = dt.TableName; ws.Cells[rowstart, colstart, rowend, colend]