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

Export to excel ... preserve format

3 Answers 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rajz
Top achievements
Rank 1
Rajz asked on 18 Nov 2010, 10:45 AM
Hello,

While exporting grid data, the data dispalyed in grid such as $8,000.00 is exported as just 8000 instead of $8,000.

Is there a way to preserve the format while exporting to excel?

Thank you

Regards
Raj

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Nov 2010, 11:54 AM
Hello Raj,

I suggest that you examine the Number formats / Formulas section in the following topic:
Word/Excel export (HTML-based)

Let me know if you need more information.

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Rajz
Top achievements
Rank 1
answered on 18 Nov 2010, 11:56 AM
That was good!

But my footer text is not formatted, How do I apply the format to footer too?

Thank you

Regards
Raj
0
Daniel
Telerik team
answered on 18 Nov 2010, 10:57 PM
Hello Raj,

You could use the same approach in order to apply custom styles/number format to the footer row/cells.

Sample code:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridFooterItem && isExport)
    {
        GridFooterItem item = e.Item as GridFooterItem;
        item["myColumnName"].Style.Add("mso-number-format", ...);
    }
}

I hope this helps

Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Rajz
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Rajz
Top achievements
Rank 1
Share this question
or