Telerik RadGrid, Export to Excel

7 posts, 0 answers
  1. Erik
    Erik avatar
    22 posts
    Member since:
    Apr 2009

    Posted 17 Apr 2009 Link to this post

    I've been working with Telerik RadGrid, MasterTableView an I tried to export my data to Excel but with no success. The file is created and saved on my workstation but the file is not of "Excel" kind.

    When I open the file it only contains HTML. Is this right? Excel says that the file is not of any correct Excel type!

    Update: This error only occurs when you use "Excel Viewer" due to the fact that "Excel Viewer" can't convert the outputed HTML file to a "real" Excel formated document.

    Is there anyway to get the output as a real Excel document not a invalid document in HTML?
  2. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 17 Apr 2009 Link to this post

    Hello Erik,

    As you can see in our documentation, only MS Word and MS Excel 2003 or later are supported. This doesn't include Microsoft Excel Viewer 2003 and Microsoft Excel Viewer.

    RadGrid
    exports two Excel formats:
    - HTML based
    - XML based (ExcelML / XML spreadsheet)

    Regarding the file format error I recommend you examine the following link:
    "The file you are trying to open, '[filename]', is in a different format" Excel Error

    Let us know if you need more information.

    Best regards,
    Daniel
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Town
    Town avatar
    1 posts
    Member since:
    May 2009

    Posted 09 Jul 2010 Link to this post

    Hi there,

    I've come up against the same problem (using Excel 2007 to open an XLS), and I don't think the answer above really answers Erik's original question: "Is there anyway to get the output as a real Excel document not a invalid document in HTML?"

    I'm guessing the answer is "no", it just seems strange to have an ExportToExcel() method that is actually ExportToHTML()...  Can you confirm that HTML is the only possible format to get from this method?  It's not ideal as our users will see the warning message every time they open the exported XLS.

    Thanks,
    Chris

    Edit: I should add that we're using RadGrid 4.6.1, so exporting to CSV isn't an option.
  5. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 14 Jul 2010 Link to this post

    Chris,

    Please note that Microsoft Office HTML and XML is not our proprietary format. Even though it is not a binary Excel format (BIFF) it is a still a valid Microsoft Office file format.
    If you are not satisfied with the provided export options you can use third-party libraries like NPOI.

    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
  6. siva
    siva avatar
    10 posts
    Member since:
    Oct 2010

    Posted 19 Jan 2011 Link to this post

    Hi,
    how to achive number format with this code r html code to exportexcel data with number format.
    i need exportdeecxel with number format.
    "the datasource which i has that contain the numberformat. but not the same in exportdeexcel" plz help

     RadGrid1.PageSize = RadGrid1.MasterTableView.VirtualItemCount;
               RadGrid1.ExportSettings.IgnorePaging = true;
               RadGrid1.ExportSettings.OpenInNewWindow = true;
               RadGrid1.MasterTableView.ExportToExcel();  
  7. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 24 Jan 2011 Link to this post

    Hello Siva,

    You can apply the desired number format programmatically. I recommend that you examine our online demos:
    MS Excel/MS Word/CSV
    Export to ExcelML

    or the documentation:
    Word/Excel export (HTML-based)
    ExcelML basics

    Let me know if you need more information.

    Best regards,
    Daniel
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  8. Evan
    Evan avatar
    1 posts
    Member since:
    Dec 2012

    Posted 18 Dec 2012 Link to this post

    Daniel:

               I used the bellow code to export excel .

    There are only 218 records in RadGrid but it took 3 minutes. Could you tell me how to improve efficiency?
    this.gridReports.MasterTableView.ExportToExcel();

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