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

12 posts, 0 answers
  1. Jay
    Jay avatar
    59 posts
    Member since:
    Dec 2011

    Posted 01 Feb Link to this post

    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?

  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 03 Feb Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jay
    Jay avatar
    59 posts
    Member since:
    Dec 2011

    Posted 03 Feb in reply to Pavlina Link to this post

    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();

     

  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 03 Feb Link to this post

    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
  6. Jay
    Jay avatar
    59 posts
    Member since:
    Dec 2011

    Posted 07 Feb in reply to Pavlina Link to this post

    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?
  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Feb Link to this post

    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
  8. Jay
    Jay avatar
    59 posts
    Member since:
    Dec 2011

    Posted 08 Feb in reply to Pavlina Link to this post

    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.
  9. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 11 Feb Link to this post

    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
  10. Ryan
    Ryan avatar
    2 posts
    Member since:
    Apr 2016

    Posted 02 Jun in reply to Pavlina Link to this post

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

    Browser: IE11

    Excel 2010

     

  11. scott
    scott avatar
    35 posts
    Member since:
    Mar 2011

    Posted 04 Aug Link to this post

    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

     

     

  12. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Aug Link to this post

    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.
  13. Ryan
    Ryan avatar
    2 posts
    Member since:
    Apr 2016

    Posted 08 Aug in reply to Pavlina Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017