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

Export use Bound Column Field instead of Column Display Name

4 Answers 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Mark asked on 31 Aug 2020, 12:11 PM

We need the ability to use the underline field for each column instead of the column display name as the field in the export file.  Our column display names are built dynamically and it is possible that we can have two columns display names being the same. Their underline properties will be the different, therefore, we want to use that in the export.  

 

Any help would be great.

 

Thanks

4 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
answered on 31 Aug 2020, 12:11 PM

I hit send before I could fix the TITLE.  I need it for the COLUMN NAMES in the Export files.  

Sorry

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Sep 2020, 02:14 PM

Hello, Mark,

One possible solution that I can suggest is to change the header text of the columns just before executing the export action and restore the column names afterwards.

An alternative approach, in case you are using the GridViewSpreadExport which utilizes our RadSpreadProcessing library to export the content of RadGridView to xlsx, csv, pdf and txt formats, is to handle the ExportCompleted event which is triggered when the export operation completes. Once you have the exported grid data, you can benefit from the RadSpreadProcessing library, load the Excel file and change the columns names in the workbook:
https://docs.telerik.com/devtools/winforms/controls/gridview/exporting-data/spread-export 
https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-workbooks/create-open-and-save-workbooks 
https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-cells/accessing-cells-of-worksheet 

Feel free to use this approach which suits your requirements best.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
answered on 03 Sep 2020, 02:16 PM

Yea, that's what I was afraid of.  I have a solution that is similar to that. While not ideal, it is working.   I was looking at the code and I don't see this being a huge change to the EXPORT feature.  Have a property that let's the user specify what to use for the column headers of the export file, either the Display Name or Field Name.  IMO, using the Display Name in a CSV export, is bad, for this exact reason, the possibility of having duplicate names in the Display Names of the columns.

Thanks for the help and have a great day.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Sep 2020, 05:33 AM

Hello, Mark,

Thank you for the provided feedback.

We will definitely consider it in the future improvement of the export functionality that RadGridView offers if other customers have similar requests.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Tags
GridView
Asked by
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Answers by
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or