Hi,
I struggled to get the correct data to export to Excel. I needed some extra columns to be added and some that needed to be hidden that what was already displaying on the screen. So what I did was to create another grid, populate it with data and to hide it from the user. When I click on the link it exports the data to Excel, but when I open the Excel document then there is no headers in the spreadsheet? I need the headers to display. Here is my code:
achieverList = // Get the list of achievers from the database
gvExelExport.DataSource = achieverList;
gvExelExport.DataBind();
// Export to Excel
gvExelExport.ExportSettings.IgnorePaging = true;
gvExelExport.ExportSettings.OpenInNewWindow = true;
gvExelExport.MasterTableView.ExportToExcel();
What do I need to do to display the headers?
Thanks
Brendan
I struggled to get the correct data to export to Excel. I needed some extra columns to be added and some that needed to be hidden that what was already displaying on the screen. So what I did was to create another grid, populate it with data and to hide it from the user. When I click on the link it exports the data to Excel, but when I open the Excel document then there is no headers in the spreadsheet? I need the headers to display. Here is my code:
achieverList = // Get the list of achievers from the database
gvExelExport.DataSource = achieverList;
gvExelExport.DataBind();
// Export to Excel
gvExelExport.ExportSettings.IgnorePaging = true;
gvExelExport.ExportSettings.OpenInNewWindow = true;
gvExelExport.MasterTableView.ExportToExcel();
What do I need to do to display the headers?
Thanks
Brendan