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

Exporting from grid issue with Dollar sign ExcelML

1 Answer 160 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jaesoon
Top achievements
Rank 1
Jaesoon asked on 09 Jun 2017, 04:35 AM

I have an issue with the grid exporter when trying to export into the ExcelML format.

 

I have a few columns which have strings but when exporting as the ExcelML format, the string kept being truncated at the same place.

 

Upon further investigation, it appears that for some reason, the Dollar sign ($) is used to signify the beginning and end of a string, hence the comments in the columns all began when it saw the $ sign.

 

I have tried exporting using the Html format and can see that the complete string exports correctly.

 

Is there a reason why exporting as an ExcelML treats $ characters as string begin and end and is there a way to escape this character?

 

 

I am currently using Telerik Silverlight version 2013.3.1016.1050

 

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 13 Jun 2017, 09:49 AM
Hello ,

The dollar sign is treated as a special character in Microsoft Excel. Good explanations of its purpose can be found in the following thread and this blog post.

I'm afraid I'm currently unable to reproduce the issue with the project I attached to my reply and Excel 2016. By default, the ShouldEncodeValue property of the GridViewElementExportingEventArgs is set to True, which means that special characters will be escaped if you do not explicitly set this property to False.

You can, however, manually escape this character by modifying the exported value in the ElementExporting event of the RadGridView control.

private void RadGridView_ElementExporting(object sender, GridViewElementExportingEventArgs e)
{
    var value = e.Value?.ToString();
    if (value != null && value.Contains("$"))
    {
        e.Value = "'" + value;
    }
}

Here's a thread which suggests possible approaches for escaping characters in Excel formulas.

If the aforementioned approach does not work for you, please let me know how this scenario differs from the setup you have at your end so that I can better assist you.

I'm looking forward to your reply.

Regards,
Dilyan Traykov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Jaesoon
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or