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

Export to Excel Filename issue

9 Answers 293 Views
Grid
This is a migrated thread and some comments may be shown as answers.
canfield
Top achievements
Rank 1
canfield asked on 19 Jan 2010, 03:17 AM
Hi Telerik user,

I have tried to implement export to excel functionality in radgrid but encounter issue with filename setting.
From the file download window after I fire exportToExcel() function from javascript:
When I click on open, the filename is not shown correctly (It shows page name instead of filename) but
When I click on save and put the file in a folder and then open the file, it shows correct filename.

I have tried to put filename as a parameter to exportToExcel(filename) but it is still showing incorrect filename.

Here is my code snippet:

<script type="text/javascript" language="javascript">  
    function Export() {  
        var masterTable = $find('RadGrid1').get_masterTableView();  
        if (masterTable != null)  
            masterTable.exportToExcel();  
    }  
</script> 
 
        <telerik:RadGrid ID="RadGrid1" ShowStatusBar="True" Height="360px" 
            runat="server" AutoGenerateColumns="False" AllowSorting="false"   
            GridLines="None" ShowFooter="false" EnableDrag="false" 
            OnNeedDataSource="RadGrid1_NeedDataSource" ExportSettings-FileName="NostroTransfer" 
            OnItemDataBound="RadGrid1_ItemDataBound"

Please share if you have ever encountered this issue.

Regards,
Canfield

9 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Jan 2010, 10:27 AM
Hello Jack Canfield,

Try setting the OpenInNewWindow property to true in the ExportSettings tag of the RadGrid as shown below:
aspx:
 <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server">  
   <ExportSettings OpenInNewWindow="true" FileName="MyFileName"
   </ExportSettings>  

Thanks
Princy.
0
canfield
Top achievements
Rank 1
answered on 20 Jan 2010, 08:45 AM
Hi Princy,

I've tried your advice but I am still getting the same result.
Anyway thanks for your advise.

Regards,
canfield
0
Daniel
Telerik team
answered on 20 Jan 2010, 12:56 PM
Hello Canfield,

This problem occurs in Internet Explorer 6 and 7 when the content-disposition is set to inline (i.e. OpenInNewWindow="false").

Please go to the following demo, mark the "" option and let me know whether the file name is DefaultCS.xls (wrong) or RadGridExport.xls (correct)
MS Excel/MS Word/CSV

Kind regards,
Daniel
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
Amrit
Top achievements
Rank 1
answered on 08 Apr 2014, 06:31 PM
I have OpenInNewWindow="true" configured for my RadGrid.  However, when I try to export to Excel, the filename is coming back as the page filename_aspx, which is incorrect.  Do you have a solution for this?
0
Daniel
Telerik team
answered on 09 Apr 2014, 05:37 PM
Hello Amrit,

Can you please share what is your browser name/version? Also can you reproduce the problem on the online demo shown below?
MS Excel/MS Word/CSV

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
RBarnes
Top achievements
Rank 1
answered on 14 Apr 2014, 06:45 PM
I'm seeing the same results as the OP, the requested filename isn't used, if I'm exporting using IE11, in Chrome, it seems to work fine.  The same also applies to the online demo posted above.

0
Daniel
Telerik team
answered on 15 Apr 2014, 01:13 PM
Hello Roger,

I'm not able to reproduce the issue in IE11 when OpenInNewWindow property is enabled. Please examine the attached runnable demo and screenshot.
Let me know if I'm missing something.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
RBarnes
Top achievements
Rank 1
answered on 15 Apr 2014, 01:37 PM
I ran your demo, I got the same results as my application and the online demo mentioned above.  IE11 doesn't acknowledge the filename Chrome does.  See the attached IE11 results.  Regardless of which button I click the results are identical.  I'm running version 2014.1.225.40
0
Daniel
Telerik team
answered on 22 Apr 2014, 08:25 AM
Hello Roger,

I have to ask you some questions as I'm not able to reproduce the problem locally.
Do you have Microsoft Excel installed on this machine? Also do you use some kind of response compression mechanism? Do you run the website via localhost? If this is not the case, do you have SSL enabled?
By the way, not that it matters much in this case but judging on your screenshots, your browser seems to be IE9. Am I leaving out something?

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
canfield
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
canfield
Top achievements
Rank 1
Daniel
Telerik team
Amrit
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Share this question
or