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

Formatting Footer cell in OnExportCellFormatting

3 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joey
Top achievements
Rank 1
Joey asked on 04 Oct 2013, 05:29 AM
Hi, I have a currency value column in a radgrid, and exporting to excel using this function for formatting the currency cells

        protected void RadGrid_OnExportCellFormatting(object sender, ExportCellFormattingEventArgs e)
        {
            if (e.FormattedColumn.DataType == typeof (long))
            {
                e.Cell.Style["mso-number-format"] = "Currency";
            }
       }

This is based on advice in another post in this forum. Works very well, but it doesn't format the footer item which is an aggregated sum value. How do I format the footer to be currency as well?

Thanks for reading

3 Answers, 1 is accepted

Sort by
0
Joey
Top achievements
Rank 1
answered on 05 Oct 2013, 02:49 AM
Anyone knows how to format currency in export footer?
0
Kostadin
Telerik team
answered on 08 Oct 2013, 11:28 AM
Hello Joey,

A possible solution is to get the footer item and set the same format on the appropriate cells. I prepared a small sample and attached it to this forum post.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Joey
Top achievements
Rank 1
answered on 08 Oct 2013, 02:57 PM
Hi Kostadin, the sample works very well.

Over the past few days I've come up with a workaround by adding a currency style to the export by using e.ExportOutput.Replace("<head>", "<head>" + cssStyle) in GridExporting, and then setting the cssclass of each footer cell in HTMLExporting. Works too, but your sample is much cleaner, and easier to implement. Thanks.
Tags
Grid
Asked by
Joey
Top achievements
Rank 1
Answers by
Joey
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or