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

Remove columns in Excel export

1 Answer 443 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Russell
Top achievements
Rank 1
David Russell asked on 09 Jun 2010, 03:19 AM
I've been at this for hours.

I have a grid with:
 Edit Column
 Delete Column
 Bound Column

I want to export this as Excel.

I get the Bound Column in column C with columns A and B blank. I don't want columns A and B at all.

My last attempt was like this based on http://www.telerik.com/help/aspnet/grid/grdexporttipstricks.html

        protected void IndicationsExport(object sender, EventArgs e) 
        { 
            gridIndications.MasterTableView.Columns.FindByUniqueName("EditColumn").Visible = false
            gridIndications.MasterTableView.Columns.FindByUniqueName("DeleteColumn").Visible = false
            gridIndications.MasterTableView.ExportToExcel(); 
            gridIndications.MasterTableView.Columns.FindByUniqueName("EditColumn").Visible = true
            gridIndications.MasterTableView.Columns.FindByUniqueName("DeleteColumn").Visible = true
        } 
 

This too does not work.

Can you tell me how to remove columns from the resulting Excel file?

Remove rows?




1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Jun 2010, 02:53 PM
Hello David,

Please remove the following code:
gridIndications.MasterTableView.Columns.FindByUniqueName("EditColumn").Visible = true;            gridIndications.MasterTableView.Columns.FindByUniqueName("DeleteColumn").Visible = true;

Note that all changes that you made after initiating the export will affect the exported file only!

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
David Russell
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or