Completed
Last Updated: 25 Aug 2015 07:08 by ADMIN
Chris
Created on: 19 Aug 2015 11:29
Category: GridView
Type: Bug Report
0
IMPROVE. RadGridView - ExportToExcelML trim the FileExtension starting dot
(Two related issues)

1) If I call method RunExport(@"C:\Temp\Foo.xml") on an instance of ExportToExcelML, it creates a file called "C:\Temp\Foo.xls" (notice the change of the file extension).

2) But "*.xls" is the wrong file extension, causing Excel to produce a "The file format and extension of 'Foo.xls' don't match..." warning when the file is opened. This warning does not appear if the file is saved as "*.xml". 

My suggestion: 

1) Keep any given file extension in ExportToExcelML.RunExport(..)
2) Adjust the intellisense help text of the RunExport-method accordingly that it mentions the possibility to save the file with extension ".xml" to avoid the said excel warning but with the drawback that this file extension is not exclusively associated with Excel.
5 comments
ADMIN
Stefan
Posted on: 21 Aug 2015 06:43
Thank you for your suggestion. We will consider its implementation.
Chris
Posted on: 20 Aug 2015 08:29
To point 1) an additional comment: When I now changed my code to use the FileExtension property, I tried the following:

String myFileName = @"C:\Temp\Foo.xml";
...
exporter.FileExtension = Path.GetExtension(myFileName);
exporter.RunExport(myFileName); 

which resulted in a file called "C:\Temp\Foo..xml" (with double-dots) and I had to change my code to

String myFileName = @"C:\Temp\Foo.xml";
...
exporter.FileExtension = Path.GetExtension(myFileName).TrimStart('.'); 
exporter.RunExport(myFileName); 

to get "C:\Temp\Foo.xml", which I consider rather ugly. I would have expected that I can set a value of either "xml" or ".xml" to get a file called "*.xml".

Can you improve the FileExtension property in a way that a leading dot is automatically trimmed for us? 

Thank you
Christoph
ADMIN
Stefan
Posted on: 20 Aug 2015 07:03
No problem. All the best.
Chris
Posted on: 20 Aug 2015 06:54
1) Oooops, overlooked that.
2) Thank you for the tip with the native excel exporter.

My apologies for having wasted your time and thank you for the quick and helpful feedback.

Christoph
ADMIN
Stefan
Posted on: 19 Aug 2015 15:03
Hi Christoph,

1. The exporter has a property called FileExtension that allows you to set the extension to "xml"

2. We are aware of this and we have it explained in an article here: http://www.telerik.com/support/kb/winforms/gridview/details/radgridview-export-to-excel-tips-and-tricks

Most important, we have a new export provider, which allows exporting to native Excel format - xlsx. More information about it can be found here: http://www.telerik.com/help/winforms/gridview-exporting-data-spread-export.html