This question is locked. New answers and comments are not allowed.
Hi,
in my gridview I've added a custom column showing the row number, as shown in this example:
http://demos.telerik.com/silverlight/#GridView/RowNumber
Here's the code:
When I export the gridview to excel the custom column is not exported.
This is not a problem for me, but I have multiple headers and in the excel file the first row has an extra cell on the left (see attached image).
How can I solve the problem?
Thanks.
in my gridview I've added a custom column showing the row number, as shown in this example:
http://demos.telerik.com/silverlight/#GridView/RowNumber
Here's the code:
<telerik:RadGridView.ColumnGroups> <telerik:GridViewColumnGroup Name="Identificazione" Header="IDENTIFICAZIONE></telerik:GridViewColumnGroup> <telerik:GridViewColumnGroup Name="...</telerik:RadGridView.ColumnGroups> <telerik:RadGridView.Columns> <custom:MyColumn Header="#" Width="50" Background="#7F2FB3FD"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Codice}" Header="Codice" IsReadOnly="True" Width="81" ColumnGroupName="Identificazione"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding Descrizione}" Header="Descrizione" IsReadOnly="True" Width="145" ColumnGroupName="Identificazione"/> <telerik:GridViewDataColumn...
public class MyColumn : Telerik.Windows.Controls.GridViewColumn { public override FrameworkElement CreateCellElement(Telerik.Windows.Controls.GridView.GridViewCell cell, object dataItem) { TextBlock textBlock = cell.Content as TextBlock; if (textBlock == null) { textBlock = new TextBlock(); } textBlock.Text = (this.DataControl.Items.IndexOf(dataItem) + 1).ToString(); return textBlock; } }When I export the gridview to excel the custom column is not exported.
This is not a problem for me, but I have multiple headers and in the excel file the first row has an extra cell on the left (see attached image).
How can I solve the problem?
Thanks.