asp.net - Export Data to excel using C# with separate header fields -


i have export data excel.i have done exporting data, sql query , bind them grid view , after exporting grid view excel. works fine.

but issue when there additional information display in excel sheet below (report date , style name), how can add them top of excel sheet before data list.

sample format

are there libraries available this.. plzz help...

and asp.net application.

take @ epplus library.

you can bind resultset returned sql query worksheet , insert new row @ desired position.

private void dumpexcel(datatable tbl) {    using (excelpackage pck = new excelpackage())    {      //create worksheet      excelworksheet ws = pck.workbook.worksheets.add("demo");        //load datatable sheet, starting cell a1.      ws.cells["a1"].loadfromdatatable(tbl, true);      excelworksheet.insertrow(int rowfrom, int rows, intcopystylesfromrow);       response.contenttype = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";      response.addheader("content-disposition", "attachment;  filename=exceldemo.xlsx");      response.binarywrite(pck.getasbytearray());     }  } 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -