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

RadGridView ExportToExcelML "different format" vs. "file extension" Error

17 Answers 745 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tom Chien
Top achievements
Rank 1
Tom Chien asked on 17 Sep 2009, 10:57 PM
I just upgraded from 2009Q1 (2009.1.9.414) to 2009Q2 (2009.2.9.729) and noticed that files exported by the ExportToExcelML.RunExport Method:

1. Are now of Type ".Xls" vs. ".XML".  Is there some detailed list of changes for each I can review / search through to see how my code will be impacted?

2. Now generate a "The file you are trying to open, '<FileName>.xls', is in a different format than specified by the file extension.  Verify that the file is not corrupted and is from a trusted source before opening the file.  Do you want to open the file now?" where it didn't generate any message before.  Selecting "Yes" appears to allow it to open the the file correctly.

Telerik 2009Q2 (2009.2.9.729), VS 2005 (v8.0.50727.762 SP.050727-7600), XP SP3 on Core2Duo 2.99GHZ with 3GB.


17 Answers, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 23 Sep 2009, 11:44 AM
Hello Tom Chien,

Thank you for writing.

1. ExportToExcelML has always crated XML file but "masked" as an excel file with XLS extension. We do not change this since the first time we present ExportToExcelML class. If another extension is used, you would not be able to open the file with MS Excel by dbl-clicking on it in Windows Explorer.

2. Because ExcelML differs from native excel format (it is a XML with special formatting), MS Excel 2007 will show warning message when you try to open such a file. This comes from Microsoft and it is independently from used Telerik version. 

You can find detailed description for all changes in Release Notes document for every release. Please, take a look to the Release History section in Telerik website. Do not hesitate to contact me again if you have other questions.

Best wishes,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Tom Chien
Top achievements
Rank 1
answered on 23 Sep 2009, 04:02 PM
1. I just realized you are correct that ExportToExcelML is still creating an XML File.  However, the RunExport method in 2009Q1 was forcing an XML ("XML Document") Extension, whereas in 2009Q2, it's forcing an XLS ("Microsoft Office Excel 97-2003 Worksheet") extension, so a) the 2nd part of your statement (that it has "always ... 'masked' (the XML file) as an excel file with XLS extension") is not true, b) that change was not in the "Release Notes" whose link you sent me and c) the change to an XLS extension is causing the warning message from Excel.  Also, if I change it back to an XML Extension, contrary to your other statement, Excel will open it by " dbl-clicking on it in Windows Explorer" and do so with no warning.  Of course, that's with Excel 2007.  I don't know about 97-2003, but this is for in-house use and all our users should have 2007.   I guess I'll just have to force a rename to the XML Extension after the RunExport call (unless there's a way change the Extension that it forces).

2. The same grid data exported by the RunExport method in 2009Q2 generates a file that's ~45% (1056 Kb vs. 729 KB) vs. the one in 2009Q1.  That was not in the Release Notes either.
0
Accepted
Martin Vasilev
Telerik team
answered on 28 Sep 2009, 03:08 PM
Hi Tom Chien,

Thank you for getting back to me. We slightly changed the way ExportToExcelML works by adding an extension for the generated files. It is possible that in our previous versions - in some specific circumstances - you were able to export with the xml extension but now it is only xls. Our goal is to make the resulting file looks like an excel file and be open by MS Excel by default. If you still want other extensions for your exported files, you can easily implement an extension substitution on your own.

The larger file size is because the new version processes styles in a different way. Currently the exported files contain more information about excel styles and this improves data formatting in many cases. All fixes and improvements are mentioned in the release notes.

Write me back if you have other questions.

Regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ruth Goldberg
Top achievements
Rank 1
answered on 03 Feb 2010, 07:47 PM
I'm having the same problem. Even when I pass the extension of xml, RunExport changes it to xls and I get an error in Excel. If I manually change the extension of the file, afterward, to xml, the file shows an Excel icon and opens fine in Excel with no warning. You really should change the program. There seems to be no good reason to force the xls extension when xml is a legitimate Excel extension.
0
Martin Vasilev
Telerik team
answered on 08 Feb 2010, 03:49 PM
Hi Ruth Goldberg,

Thank you for writing.

Actually, we considered to add a new property which would specify the extension of exported file. This will give more exporting flexibility in terms of file recognizing. We will introduce this property in the next major release: Q1 2010. Let me know if you have any other questions.

All the best,
Martin Vasilev
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Ruth Goldberg
Top achievements
Rank 1
answered on 16 Mar 2010, 04:49 PM
I upgraded to Q1 2010 and can't see any property to specify the extension. Has this functionality been added? It's still changing my extension from xml to xls.
0
Martin Vasilev
Telerik team
answered on 19 Mar 2010, 09:58 AM
Hi Ruth Goldberg,

Thank you for contacting us. We have postponed this feature for the next release, because we are going to introduce the new export formats and revised ExporToExcelML class together with a completely refactored RadGridView. Let me know if you have any additional questions.

All the best,
Martin Vasilev
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.
0
Senthil Gnaesa
Top achievements
Rank 1
answered on 28 May 2010, 12:17 PM
Hi,
i am using the following code to export a grid to excel

Dim

 

objExporter As ExportToExcelML = New ExportToExcelML(RadGridView1)

 

objExporter.ExportVisualSettings =

True

 

objExporter.SummariesExportOption = SummariesOption.ExportAll

 

'objExporter.HiddenColumnOption = Telerik.WinControls.UI.Export.E

 

 

 

Dim strTempFileName As String = "D:\Exported\Test.xls"

 

objExporter.RunExport(strTempFileName)

But when i look @ the exported file i could not find gridlines

Also  i could not find the event
exporter_ExcelCellFormatting event



Thanks,
Senthil

0
Martin Vasilev
Telerik team
answered on 02 Jun 2010, 05:47 PM
Hello Senthil Gnaesa,

Thank you for contacting us.

I suppose you need to include the borders into the result Excel file. This can be done only through the ExcelCellFormatting event as shown in the Events section of the ExportToExcelML documentation. You can create an event handler for ExcelCellFormatting as it follows:
AddHandler ExportToExcelML.ExcelCellFormatting, AddressOf ExportToExcelML_ExcelCellFormatting

Let me know if you have any other questions.

Best wishes,
Martin Vasilev
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.
0
Lester
Top achievements
Rank 1
answered on 27 Oct 2011, 11:15 AM
Hi,

We are using Q1 2011 and I still get the warning message when opening the exported xls file in Excel. I can see the format is still XML as mentioned above in the thread. Has there been any changes to ExportToExcelML functionality as mentioned by Martin Vasilev above.

Is there a workaround to avoid getting the warning message.

Thanks,
Lester Lasrado
0
Martin Vasilev
Telerik team
answered on 31 Oct 2011, 04:03 PM
Hello Lester,

Thank you for writing.

Yes, ExportToExcelML still uses a special XML format to create an exported file, hence the warning message while opening the file. However, there is an easy way to avoid the warning: export the file with xml instead the default xls extension:
ExportToExcelML exporter = new ExportToExcelML(this.radGridView1);
exporter.FileExtension = "xml";

In this way MS Excel will still open the file, but a warning will not be shown,  because the extension matches the file format.

Hope this helps. Let me know if you have any other questions.
 
Kind regards,
Martin Vasilev
the Telerik team

Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

0
N Mackay
Top achievements
Rank 1
answered on 11 Apr 2012, 10:43 AM
Hi,

Changing to xml doesn't work as you'd need a group policy change to force excel to open the fix rather than IE by default, in our case this would break other systems and isn't a satisfactory solution.

The code below generates Text.xml but has an excel association but obvioulsy tries to open with IE.
Dim exporter As ExportToExcelML = New ExportToExcelML(Me.radgrid_dataview)
exporter.FileExtension = "xml"
exporter.ExportVisualSettings = True
exporter.RunExport("D:\Test.xls")
System.Diagnostics.Process.Start("D:\Test.xls") -- errors

As it stands we have to use the CSV export on give up on this gridview which is a shame as it has some nice feature, we bought Ultimate edition but generally it was for WPF controls, this is our 1st usage of the winforms controls and it's been a major disappointment,

This is using the latest build in .NET4 on Win7 64bit and office 2010 32bit
0
Nikolay
Telerik team
answered on 11 Apr 2012, 11:28 AM
Hello Norman,

Indeed, as I have replied in your support ticket, if the xml file is associated with a certain application, it will always be opened with that application, no matter what the content of the file says.

In general, the only two solutions are:
- Change the file extension to xml, but remove the application association that your system has with the XML file type.
- Disable the warning message which appears when you open the XLS file exported by RadGridView Excel exporter by following this article.  

As I replied in your support ticket, it is not our feature that is not built according to the xml specifications of the Excel format, but it is the OS that wants to prevent you from possible security risks, because of the fact that the file ends up with XLS, while it is in xml format. There is nothing else that can be done in this case, apart from the solutions that I provided above.

All the best,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
N Mackay
Top achievements
Rank 1
answered on 11 Apr 2012, 11:33 AM
Nikolay,
 
Thanks for your response. I have responded to the ticket.

I can't accept your argument as I have used TxTextControl and other reporting tools to export to excel for opening (2003,2007 & 2010) with no such issues, why is this piece of software the exception to the rule?

Unfortunately this makes the control useless for our needs and therefore the winforms controls. I can confirm after discussions internally that we won't purchase Ultimate next time round.

Regards,
Norman.
0
Nikolay
Telerik team
answered on 11 Apr 2012, 12:33 PM
Hello Norman,

I regret to hear about your decision.

At this time I can't comment the capabilities of our competitor, but as far as our suite is concerned, these are the options in order to prevent the warning message from appearing. We will investigate if something can be improved in this direction, but until now we have not found other ways to avoid the warning message.

Let us know if you have additional questions.

Greetings,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
N Mackay
Top achievements
Rank 1
answered on 11 Apr 2012, 12:48 PM
Hi Nikolay,

I appreciate your assistance in trying to sort this.

We do need the grouping so we'll have to live with the CSV export, it's not the end of the world but it's not very slick to say the least but at least we can export and open in excel. I left feedback on the ticket regarding why we've decided not to carry on with Ultimate.

We could never implement the workarounds as XML documents should be associated with IE and it would potentially break a lot of legacy systems, our group policy guys and the dev team agreed it was a non-starter. No one can understand why openxml format wasn't used.

I would suggest Telerik do revisit this if possible and also consider changing the feature so you can dump the data into excel rather than having to create a file although I can understand why that might be difficult, I saw a lot of people asking for that feature on the forums.

Regards,
Norman.
0
Nikolay
Telerik team
answered on 11 Apr 2012, 01:08 PM
Thank you for the feedback, Norman,

Indeed, it will be a step in the right direction if we implement exporting in the native Excel format. We will discuss this feature and research it further, but currently I am not able to provide you with any time frame in which this would happen.

Kind regards,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Tom Chien
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Tom Chien
Top achievements
Rank 1
Ruth Goldberg
Top achievements
Rank 1
Senthil Gnaesa
Top achievements
Rank 1
Lester
Top achievements
Rank 1
N Mackay
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or