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

Hiding / Showing Columns for Export

5 Answers 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ozan
Top achievements
Rank 1
Ozan asked on 06 May 2014, 01:33 PM
I have a RadGridView(Telerik) that contains data. I don't want to see  / want to see some columns in Excell or PDF but I can't hide column for Exporting. How can I do this ? Also, When exporting checkbox columns it is seen true/false in PDF but I want to see this different for Example 'Yes' 'No'. 

5 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 06 May 2014, 02:41 PM
Hi,

To control which columns will be exported, you could subscribe for the ElementExporting event of RadGridView.  Once the event is raised, you can cancel the export (via e.Cancel=true) when the Column of the currently exported element is a column you would like to skip. 
Similarly when this event is raised you can change the e.Value to be exported. Instead of
true/false you could set it to 'Yes'/'No'. 

Please try this and let me know if you need any further assistance.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Ozan
Top achievements
Rank 1
answered on 07 May 2014, 06:41 AM
I shudder to think there is no event that you said. I am using telerik Q1 2013. Is its name different ?
0
Dimitrina
Telerik team
answered on 07 May 2014, 08:55 AM
Hello,

The ElementExporting and ElementExported events were added with Q1 2010 SP2. You can also refer to our online documentation: Export Events.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Ozan
Top achievements
Rank 1
answered on 10 May 2014, 07:11 AM
Thanks for your help but I'm sorry, I am having a problem because I haven't found the events still :)
0
Stefan
Telerik team
answered on 10 May 2014, 10:45 AM
Hello Ozan,

It seems you are using Windows Forms and not WPF, hence we moved your thread from the WPF forum (where it was initially submitted) to the WinForms forum. 

In regards to your question, if you want a certain column do be excluded from the export, you should set its IsVisible property to false, and then set the exporters HiddenColumnOption property to DoNotExport. More information about this is available here: http://www.telerik.com/help/winforms/gridview-exporting-data-export-to-excel-via-excelml-format.html.

In regards to changing the content of a cell during the export to PDF process, you can use the HtmlCellFormatting event for the purpose. An example is available here: http://www.telerik.com/help/winforms/gridview-exporting-data-export-to-pdf.html.

I hope that you find this information useful.

Regards,
Stefan
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Ozan
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Ozan
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or