ExportToXlsx sometimes gives Excel error when opening document (seems to be with columns with null values)

8 posts, 1 answers
  1. Peter
    Peter avatar
    6 posts
    Member since:
    Mar 2015

    Posted 11 May 2015 Link to this post

    I use ExportToXlsx to export gridview data to an excel file using the following code snippet

     

    gridView.ExportToXlsx(fs, new GridViewDocumentExportOptions()
    {
        ShowColumnHeaders = true,
        AutoFitColumnsWidth = true
    });

     

     Sometimes when opening the file in Excel I get the error message:

     

         Excel found unreadable content in ... Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

     

    I can open the file after clicking yes, but the content is not in sync with the information as shown in the GridView.

    It seems that this happens when the grid has empty cells e.g. we have a date field which can be omitted (null).

    If I use the exportToPdf method al goes well using the same date in the gridview. So it seems it's an issue related to Excel export.

    Is this a bug or otherwise how can I fix this issue? 

    I use version 2015.1.401.45

     

    Regards,
    Peter

     

  2. Answer
    Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 May 2015 Link to this post

    Hello Peter,

    We are aware of a such a problem and it is already resolved. The fix is included in the latest internal build.

    Would you please try it and let me know how does it work for you?


    Regards,
    Dimitrina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Peter
    Peter avatar
    6 posts
    Member since:
    Mar 2015

    Posted 11 May 2015 in reply to Dimitrina Link to this post

    Hi Dimitrina,

    Internal build 504 does indeed seem to solve the problem.

    When can we expect the official release of this fix?

     Thanks and regards,
    Peter

     

  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 May 2015 Link to this post

    Hi Peter,

    I am glad to hear that. The next official version(Q2 2015) is scheduled to be released until the end of June.

    Regards,
    Dimitrina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  6. Jim
    Jim avatar
    2 posts
    Member since:
    Aug 2015

    Posted 26 Aug 2015 in reply to Dimitrina Link to this post

    I experienced similar problem: 

    var exportOptions = new GridViewDocumentExportOptions()     

    {         

    ExportDefaultStyles =true,                 

    ShowColumnFooters = true,                 

    ShowColumnHeaders = true,                 

    ShowGroupFooters = true     };     

    var tempFilename = @"c:\temp\telegridexport.xlsx";     

    using (FileStream steam = new FileStream(tempFilename, FileMode.CreateNew))         

      this.Quotes.ExportToXlsx(steam, exportOptions);     

       ExcelInstance.OpenExcelFile(tempFilename);

    }

      the grid have Column group in the grid.    dll version:  2015.2.728.45

     

    I get error like:

    Excel found unreadable content in "telegridexport.xlsx'. Do you want to recover the contents of this workbook?  If you trust the source of this workbook, click Yes

     from excel log:

    <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error189520_04.xml</logFileName><summary>Errors were detected in file 'C:\temp\telegridexport.xlsx'</summary><repairedRecords summary="Following is a list of repairs:"><repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord></repairedRecords></recoveryLog>

      

  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 27 Aug 2015 Link to this post

    Hi,

    As it turns out I could not reproduce any issue when exporting RadGridView with column groups locally. 
    Would it be possible for you to isolate the exact setup you have in a demo project and send it to us via a support ticket? That way we can debug it at our side and advice further.

    Regards,
    Dimitrina
    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. Jim
    Jim avatar
    2 posts
    Member since:
    Aug 2015

    Posted 27 Aug 2015 in reply to Dimitrina Link to this post

    I removed the column group, it still have error.    It will be very difficult for me to create a demo project for this.  But I can send you the result xlsx and grid related xaml and cs file.  It is good for me not to post my code here and please provide an email I can send to.
  9. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 27 Aug 2015 Link to this post

    Hello,

    I am sorry to hear you still get an error even with the latest version. You can submit a support ticket through the ticketing system here.

    Regards,
    Dimitrina
    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
Back to Top
UI for WPF is Visual Studio 2017 Ready