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

File Extension Not Working for Excel Export

11 Answers 733 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 22 May 2010, 12:53 AM
Hello Telerik team,

I know there are hundreds of posts around this topic, but I couldn't find a specific one regarding this issue

I set

RadGrid1.ExportSettings.Excel.FileExtension = "xlsx";

I expect that the exported file will have an extension of .xslx

Instead, I am getting RadGridExport.xslx.xsl  ???

How do I get the file extension I want?

Thanks
Bob

11 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 27 May 2010, 02:25 PM
Hello Bob,

To be honest, I don't see much point to change the file extension to xlsx - what's more, even if you change the extension manually, Microsoft Excel won't be able to open the file because Microsoft Office will detect the difference between the MIME type and the file content and will then add its own autodetected extension.
 
It would be better to leave the default file extension and then re-save the file in the format you like.

Best regards,
Daniel
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
Bob
Top achievements
Rank 1
answered on 27 May 2010, 05:19 PM
Okay, so the purpose of the Property is ?????
0
Daniel
Telerik team
answered on 27 May 2010, 09:50 PM
Hello Bob,

The purpose is to allow the developer to change the file extension. Unfortunately there are some limitations - in this particular case Microsoft Excel impose restrictions over the allowed extensions.
Since the ExcelML format is XML-based format, you could set the file extension to XLS, XML, XSL, etc.

This is the same as for the CSV format - you could safely change its extension to TXT.

Kind regards,
Daniel
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
Bob
Top achievements
Rank 1
answered on 27 May 2010, 10:00 PM
Okay, I sort of understand, but the property is misleading and confusing.  If I am not actually able to change the FileExtension, then this property is really just some suffix that gets tacked onto the end of the filename....

All I am asking for is a bit of cleanup or consistency.  If I can;t modify the actual file extension of the downloaded file, then perhaps not teasing me with a Property that claims to do this would be helpful.  I got all excited about being able to set the extension (we have use cases that necessitate the Office 2007 extensions) only to find out it doesn;t work

But thanks for your explanations though...

Bob

0
Daniel
Telerik team
answered on 28 May 2010, 07:44 PM
Hello Bob,

I'm afraid we can't remove the property but we can (and will do) explain this limitation in the documentation to facilitate our customers.

Best regards,
Daniel
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
Chuck
Top achievements
Rank 1
Veteran
answered on 14 Nov 2018, 04:05 PM
If this were true why wouldn't the extension be changed to HTML when the Format = GridExcelExportFormat.Html? Is there no way to change the filename extension?
0
Tsvetomir
Telerik team
answered on 19 Nov 2018, 01:38 PM
Hi Chuck,

Setting the Export Format property to HTML is not designed to export to an HTML file. It does export grid's content to an Excel file based on the HTML and CSS. This behavior is explained in the overview of the following article.

HTML-Based Export 

Furthermore, RadGrid exporting functionality exposes a plethora of supported formats such as Excel, PDF, CSV etc. 

Supported Formats

Creating and exporting to custom files which are not listed in the article above might lead to unexpected complications. 

Is there a specific requirement you would like to cover? If you share your thoughts on the topic and provide more detailed information, I would be able to provide a more accurate answer.


Best regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Chuck
Top achievements
Rank 1
Veteran
answered on 19 Nov 2018, 03:17 PM
This is part of the need to be able to change the cell color based upon the cell value and the only why I've been able to do this is using the HTML format and the Export event as you had shown me but when the user goes to open the file in Excell the mesg appears that the file is in the wrong format because the extension is defaulted to "XLS". Why can't I be able to change the file extension when using the HTML filetype to avoid this message?
0
Tsvetomir
Telerik team
answered on 20 Nov 2018, 01:21 PM
Hi Chuck,

The described error message is a known issue for older version of Excel files and is documented in the following article: Excel Format (HTML-Based)

If you use the newer format XLSX (Open XML), this warning will not be shown. To do that, set the Format property to "Xlsx" in the ExportSettings of the grid and include the rest of the assemblies that can be found in the AdditionalLibrary folder of the Telerik/Progress installation directory.

<ExportSettings>
    <Excel Format="Xlsx" />
</ExportSettings>

Should you require further clarifications, free to contact me.

Kind regards,
Tsvetomir
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Chuck
Top achievements
Rank 1
Veteran
answered on 26 Nov 2018, 06:33 PM
Seems to be a problem, getting the attached error.
0
Peter Milchev
Telerik team
answered on 28 Nov 2018, 02:59 PM
Hello Chuck,

The allowed upload file extensions for the forum are .gif, .jpg, .jpeg, .png. 

What I can suggest is opening an official support ticket where you can attach .zip and .rar archives up to 20MB with a small runnable sample reproducing the observed error. This will allow us to investigate locally your exact scenario and provide more accurate and specific suggestions. 

Once we have a solution in the support thread, we can share the solution here for convenience and better visibility from the community. 

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Bob
Top achievements
Rank 1
Chuck
Top achievements
Rank 1
Veteran
Tsvetomir
Telerik team
Peter Milchev
Telerik team
Share this question
or