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

Exporting to xlsx also export GridEditCommandColumn but should not

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Veronique
Top achievements
Rank 1
Veronique asked on 22 Aug 2016, 03:07 PM

Until recently I was exporting to Excel using ExcelML format.  The GridEditCommandColumn was not exported (ExportOnlyData is set to true).
I am now exporting using XLSX format.  Since then, the GridEditCommandColumn is exported along with data.
I would expect the same behaviour (no edit column). 

Is it a bug ? 
Is there an option to hide GridEditCommandColumn when exporting to xlsx ?

<telerik:RadButton ID="ButtonExportExcelML" runat="server" Text="Export to ExcelML" OnClick="ButtonExportExcelML_Click" />   
<telerik:RadButton ID="ButtonExportXLSX" runat="server" Text="Export to XLSX" OnClick="ButtonExportXLSX_Click" />   
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" ExportSettings-ExportOnlyData="true" OnNeedDataSource="RadGrid1_NeedDataSource">
    <MasterTableView>
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    RadGrid1.DataSource = new List<int> { 1,2,3,4,5,6};
}
 
protected void ButtonExportExcelML_Click(object sender, EventArgs e)
{
    RadGrid1.ExportSettings.FileName = "TestExcelML";
    RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
    RadGrid1.ExportToExcel();
}
 
protected void ButtonExportXLSX_Click(object sender, EventArgs e)
{
    RadGrid1.ExportSettings.FileName = "TestXlsx";
    RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;
    RadGrid1.ExportToExcel();
}

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 23 Aug 2016, 12:21 PM
Hello,

In order to prevent the edit column from exporting you can set the Exportable property for it to false.


<telerik:GridEditCommandColumn Exportable="false"></telerik:GridEditCommandColumn>



Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Veronique
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or