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

[Solved] RadGrid ExporttoEXcel with command item footer template and formated grid.

1 Answer 170 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mritunjay
Top achievements
Rank 1
Mritunjay asked on 16 Feb 2010, 04:33 PM
Hi ,

I tried to export data from radgrid to excel with command item and footer. I am able to export the data successfully. But I am not able to format the grid data . for example I am not able to set color for item and alternateitemtemplate.

wehen i am using xliml format then i am able to formate the color for item and alternateitemtemplate but I am not able to send command item and footer. xliml will work only if you set setonlydata = true.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Feb 2010, 09:45 PM
Hello Mritunjay,

When exporting to HTML Excel, you can easily distinguish whether the item is alternating or not:
protected void RadGrid1_ExcelExportCellFormatting(object source, ExcelExportCellFormattingEventArgs e)
{
    if((e.Cell.Parent as GridItem).ItemType == GridItemType.Item)
        e.Cell.Style["background-color"] = "#BBB";
    else if((e.Cell.Parent as GridItem).ItemType == GridItemType.AlternatingItem)
        e.Cell.Style["background-color"] = "#AAA";
}

If you want to export additional rows in ExcelML file, you should add them manually on ExcelMLExportRowCreated.

Let me know if you need more information.

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
Mritunjay
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or