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

RadGrid ExportToExcel to default save as xls format

3 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 07 Dec 2013, 02:34 AM
Hello,

I'm looking at some code that uses the RadGrid1.MasterTableView.ExportToExcel()
type command. It sends the grid to excel just fine. However, when my client wants to save the excel file, it defaults as a web page rather than xls format. Looking at the documentation on this, my hunch is that its because the function really is sending html to excel, rather than a native xls format. Is this assumption correct?

The grid comes up in excel just as needed.
My main question is there a way to have the default excel function save the file as an xls? That is, when the user clicks "save as" in excel, it defaults to web page.  I know that all the user would have to do is click file type as xls in excel. However, there are many users, and sometimes this step is overlooked which then results in a missing document in their process. If the data given to excel in a way that it would know it's "save-as" default should be xls. I didn't know if xml/csv would solve this problem or have similar side affects.

I should point out that I'm not doing much editing of the grid before sending it to the ExportToExcel(). Only setting blank columns' visual=false.

I should point out this is on IE8, and I'm coding in C#

Thanks in advance for assistance.

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 11 Dec 2013, 03:18 PM
Hi Todd,

There is a three different excel export formats - Html based(default), ExcelML and Biff. The first one export the grid as html, the second one export it as xml and the last one as xls. You could change the format by using the following approach.
<ExportSettings>
    <Excel Format="Biff" />
</ExportSettings>


Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Stefhan
Top achievements
Rank 1
answered on 13 May 2015, 12:31 PM

Hi there.

We have the same problem. Documents are saved as .xls but default save format in Excel is "Web Page". Unfortunately we have a lot of RadGrids using HTML format for Excel export with several customizations etc, so for us it's not an option to switch all of them to another format. Is it possible to make "xls" the default format when saving from Excel and still use HTML?

 

Best regards

Stefhan.

0
Kostadin
Telerik team
answered on 18 May 2015, 06:51 AM
Hello Stefhan,

I am afraid you cannot use Biff or XLSX export format and still apply an HTML on it. The only format that allows you to use HTML is the HTML based one. In case you need decided to use Biff exprot format you have to change either declaratively or programmatically by setting Format="Biff".

Regards,
Kostadin
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Todd
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Stefhan
Top achievements
Rank 1
Share this question
or