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

Excel export from RadGrid ends with "Unable to read file"

11 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
Jay asked on 01 Feb 2016, 05:20 PM

I've got a customer who is reporting that occasionally when exporting from the grid (and then opening the file directly rather than saving it), they receive an error message box from Excel, "Unable to read file."

I have been unable to reproduce the issue, and it doesn't happen every time for them either. Any thoughts on what could be causing this?

11 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 03 Feb 2016, 10:11 AM
Hello,

Could you try setting OpenInNewWindow property to true and let me know if this helps to prevent the error? If not, could you provide your grid declaration and the related code behind in order to investigate the issue further?

I am looking forward to your reply.

Regards,
Pavlina
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
0
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 03 Feb 2016, 12:31 PM

Unfortunately, I've already got that set. The grid is declared

<telerik:RadGrid ID="RadGrid_CM" runat="server" AllowSorting="true" AllowPaging="true" PageSize="25" AllowFilteringByColumn="false"
    OnDataBinding="RadGrid_CM_DataBinding" OnItemCommand="RadGrid_CM_ItemCommand"
    OnItemDataBound="RadGrid_CM_ItemDataBound"
    ShowStatusBar="false" Skin="Simple" Width="100%">
    <MasterTableView DataKeyNames="ID" AutoGenerateColumns="false" Width="100%" CommandItemDisplay="Top" NoMasterRecordsText="No Results found.">
        <Columns>
            ...
        </Columns>
        <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" ShowExportToWordButton="false" ShowExportToExcelButton="true" ShowExportToCsvButton="false" />
    </MasterTableView>
</telerik:RadGrid>

and then in the code behind

grid.ExportSettings.FileName = FileName + DateTime.Now.ToString("yyyyMMdd");
grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
grid.GridLines = GridLines.Both;
grid.MasterTableView.AllowFilteringByColumn = false;
grid.MasterTableView.AllowSorting = false;
grid.ExportSettings.ExportOnlyData = true;
grid.ExportSettings.IgnorePaging = true;
grid.ExportSettings.OpenInNewWindow = true;
 
grid.CurrentPageIndex = 0;
grid.PageSize = int.MaxValue;
 
grid.DataSource = null;
grid.Rebind();
 
grid.MasterTableView.ExportToExcel();

 

0
Pavlina
Telerik team
answered on 03 Feb 2016, 02:46 PM
Hello,

I have tested the code you provided in a sample runnable page, however I was not able to replicate the "Unable to read file" error message. My test page is attached for your reference, give it a try and see what is the difference in your case.

Regards,
Pavlina
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
0
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 07 Feb 2016, 09:28 PM
Yes, I am unable to replicate it as well, and even at the customer, it doesn't happen every time. Any ideas on what could cause it?
0
Pavlina
Telerik team
answered on 08 Feb 2016, 08:45 PM
Hello,

Unfortunately we could not say why the error is thrown based on the provided information. However, if you manage to replicate the issue that your customer encounter send us an isolate project which we can debug and we will get back to you with a possible solution/fix for it.

Regards,
Pavlina
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
0
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 08 Feb 2016, 08:49 PM
Yeah, I'm grasping at straws at this point, was just hopeful you might have an idea to check out. Thanks for looking into it. If I'm ever able to replicate it, I'll be back.
0
Pavlina
Telerik team
answered on 11 Feb 2016, 01:18 PM
Hi,

We will be happy to help if you manage to replicate the problem.

Regards,
Pavlina
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
0
Ryan
Top achievements
Rank 1
answered on 02 Jun 2016, 04:58 PM

I am able to duplicate this if you have Excel previously open.

Browser: IE11

Excel 2010

 

0
scott
Top achievements
Rank 1
answered on 04 Aug 2016, 11:56 PM

This is a problem for us as well. I am occasionally able to replicate it from the Telerik Demo page: http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/exporting/excel-export/defaultcs.aspx downloading the HTML button and selecting the "Open" option.

 

Browser: IE 11

Excel: MS Office Professional Plus 2010, Version 14.0.7165.5000

 

 

0
Pavlina
Telerik team
answered on 08 Aug 2016, 01:32 PM
Hi,

Indeed the described problem exists. For more information on the matter and possible solutions please refer to the sticky forum thread linked below:
http://www.telerik.com/forums/html-based-export-format-is-not-working-in-excel-2010


Regards,
Pavlina
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Ryan
Top achievements
Rank 1
answered on 08 Aug 2016, 02:23 PM

This problem was happening well before Microsoft released that patch that you linked to.

Having said that using ExcelML as an export option seems to work.

Tags
Grid
Asked by
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Pavlina
Telerik team
Jay
Top achievements
Rank 2
Iron
Iron
Veteran
Ryan
Top achievements
Rank 1
scott
Top achievements
Rank 1
Share this question
or