Excel export: The file you are trying to open, '[filename]', is in a different format than specified by the file extension

19 posts, 0 answers
  1. GrZeCh
    GrZeCh avatar
    98 posts
    Member since:
    Dec 2007

    Posted 17 Jan 2009 Link to this post

    Hello!

    When I'm exporting to Excel (HTML or ExcelML) and when I'm opening exported file I'm getting this error/notification:

    "The file you are trying to open, '[filename]', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"  (Yes | No | Help)

    Is there any workaround (without changing registry/excel settings) for this to make excel not showing this question?

    Thanks

    EDIT: Ok. I've found solution for my problem here:

    http://www.grinn.net/blog/dev/2008/06/file-you-are-trying-to-open-is-in.html
  2. Trent
    Trent avatar
    11 posts
    Member since:
    Apr 2010

    Posted 08 Jun 2010 Link to this post

    Has Telerik found a fix for this yet?  I recently talked my company into switching to Telerik from another third party grid control and the former excel export does not show a warning message. 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 09 Jun 2010 Link to this post

    Hello Trent,

    Unfortunately it is not possible to address this problem directly. You could suppress the warning message on the client (using a registry setting) but this is hardly a feasible option.
    MSDN blogs: Excel 2007 Extension Warning On Opening Excel Workbook from a Web Site
    Grinn blog: "The file you are trying to open, '[filename]', is in a different format"

    As an alternative you can try a third-party library like NPOI:
    Export to Excel with third-party library (NPOI)

    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.
  5. Trent
    Trent avatar
    11 posts
    Member since:
    Apr 2010

    Posted 10 Jun 2010 Link to this post

    Thank you Daniel.  The NPOI export works great!  It took some time to set up but it will save time in the future.
  6. Murali
    Murali avatar
    1 posts
    Member since:
    Jul 2008

    Posted 17 Jun 2010 Link to this post

    Is it possible to isolate columns that I do not want to show in the excel sheet?
    Previously using "gridID.MasterTableView.ExportToExcel()" one could achieve that.
    But using the NPOI solution, you can hide it by making the column width less than 1, but the problem is that the columns are still created, it only hides it.
    So for example, say you hid the first 4 columns and made the 5th one visible, then the excel sheet would show data beginning from "column E" instead of "column A" which is unacceptable by our customer!
    I used the code excactly the way shown in the example project except for some modifications suited for my project.
  7. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 23 Jun 2010 Link to this post

    Hello Murali,

    Yes, it is possible to skip the hidden cells although this will require some modifications. I will update the code-library in the next few days.

    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
  8. Trent
    Trent avatar
    11 posts
    Member since:
    Apr 2010

    Posted 28 Jun 2010 Link to this post

    As I said, it works great, if it is not a hierarchical grid.  Is there any modifications that are documented for displaying children data? 
  9. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 02 Jul 2010 Link to this post

    Hello Trent,

    Please note that this project was created to demonstrate that the NPOI library gives you enough freedom to create and export MS Excel sheet from RadGrid. The current implementation doesn't work for complicated scenarios like hierarchy and grouping since this will require a lot of code (and different approach) and will become hard to understand.

    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
  10. Sentha
    Sentha avatar
    3 posts
    Member since:
    Mar 2008

    Posted 12 Jul 2010 Link to this post

    Hi,

    I'm also getting the same error in my application while exporting to excel. But the file name it reports is different than the one I mentioned. It takes the aspx file's name and adds .xls to it. Is there a way we can change that? I tried even in the following telerik demo link.
    http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/exporting/defaultcs.aspx

    When you click on export to excel it shows the name as RadGridExport.xls. But when you click open it shows 'defaultcs.xls'. Is there a way to open the file with the same name?

    Thanks,
    Sentha.
  11. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 15 Jul 2010 Link to this post

    Hello Sentha,

    Internet Explorer ignores the FileName property when the content-disposition header is set to inline (e.g. when ExportSettings-OpenInNewWindow="false")

    RadGrid export overview

    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
  12. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 16 Jul 2010 Link to this post

    I am having an issue with paging.  I hace set  ExportSetting.IgnorePaging = true but it still only exports the first page.  I have tried setting it before the girs is sent to the module and I have also tried to set it in the BuildTableStructure(), but still only get the first page.
  13. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 16 Jul 2010 Link to this post

    Hello Eric,

    These settings (ExportSettings) are not taken into consideration in this code-library. Please try this approach instead:
    protected void Button1_Click(object sender, EventArgs e)
    {
        RadGridExporter exporter = new RadGridExporter();
        exporter.FileName = "TestExport.xls";
        RadGrid1.AllowPaging = false;
        RadGrid1.Rebind();
        exporter.Export(RadGrid1);
    }

    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
  14. Vasanth
    Vasanth avatar
    1 posts
    Member since:
    Mar 2012

    Posted 01 Mar 2012 Link to this post

    I am using NPOI to export to excel from rad grid and I also want to remove the hidden columns from the excel that generated through NPOI.
    I saw the following post from telerik team, please let me know where can I find the code on the same. I need to remove the hidden column completely from the excel.

    POST from telerik team :
    Hello Murali,

    Yes, it is possible to skip the hidden cells although this will require some modifications. I will update the code-library in the next few days.

    Best regards,
    Daniel
    the Telerik team
  15. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 07 Mar 2012 Link to this post

    Hi Vasanth,

    The aforementioned code-library is no longer supported as our developers are currently working on a BIFF export for RadGrid.
    Please excuse us for any inconvenience caused.

    Regards,
    Daniel
    the Telerik team
    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 their blog feed now.
  16. IT Services
    IT Services avatar
    8 posts
    Member since:
    Jan 2007

    Posted 02 Apr 2012 Link to this post

    Hi Daniel,

    When will this feature (BIFF export) be implemented?

    Thanks
    Ping
  17. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 05 Apr 2012 Link to this post

    Hello Ping,

    I'm afraid I can't provide an exact timeframe but we will do our best to add this functionality for Q2 or Q3 releases this year.

    Kind regards,
    Daniel
    the Telerik team
    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 their blog feed now.
  18. Meygnanam
    Meygnanam avatar
    1 posts
    Member since:
    Aug 2012

    Posted 06 Aug 2012 Link to this post

    Dear All
      The First think is Go to Start-->Run then Type "  regedit " .After that Click on the HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security then Right Click the "Security" New-->DWORD Value then paste the " ExtensionHardening "
  19. Telugu
    Telugu avatar
    5 posts
    Member since:
    Nov 2012

    Posted 29 Nov 2012 Link to this post

    I am also facing same problem when opening excel file it showing message like

    "The file you are trying to open, '[filename]', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"  (Yes | No | Help)

    Any solution for this.

    Thanks,
    Praveen.
  20. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 03 Dec 2012 Link to this post

    Hello Praveen,

    I noticed that you already posted the same question in another forum post.
    Please refer to the other post or to the previous answers in this thread.

    Regards,
    Daniel
    the Telerik team
    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 their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017