This is a migrated thread and some comments may be shown as answers.

custom headers while using runexport method to excel

1 Answer 117 Views
GridView
This is a migrated thread and some comments may be shown as answers.
nazeer syed
Top achievements
Rank 1
nazeer syed asked on 14 Sep 2017, 09:21 AM

ExportToExcelML exporter = new ExportToExcelML(radgridview);
                exporter.ExportVisualSettings = true;
                string filePath = "c:\test";
                string filename = "myfilename" + ".xls";
                exporter.RunExport(filePath + "\\" + filename);

 

using the above snippet how to insert a custom HEADER rows in Excel 

 

 

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 14 Sep 2017, 01:17 PM
Hi Nazeer,

Thank you for writing.

From your code snippet, I see that you are using the old ExportToExcelML class. Please note that we also have the GridViewSpreadExport class which is natively exporting to the .xlsx format thanks to the DPL libraries. The spread processing engine in the libraries is more powerful so I strongly recommend that you switch to using the spread export: http://docs.telerik.com/devtools/winforms/gridview/exporting-data/spread-export.

Using the GridViewSpreadExport class you would be able to create headers and footers according to the example demonstrated here: http://docs.telerik.com/devtools/winforms/gridview/exporting-data/how-to/add-
header-and-footer-to-the-exported-document
.

Still, in case you need to stick to the old exporting engine you can create headers and footers by handling the ExcelTableCreated event: http://docs.telerik.com/devtools/winforms/gridview/exporting-data/export-to-excel-via-excelml-format#events.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
nazeer syed
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or