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

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

9 Answers 474 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 11 May 2015, 11:20 AM

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

 

9 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 11 May 2015, 12:27 PM
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.

 
0
Peter
Top achievements
Rank 1
answered on 11 May 2015, 01:04 PM

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

 

0
Dimitrina
Telerik team
answered on 11 May 2015, 01:21 PM
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.

 
0
Jim
Top achievements
Rank 1
answered on 26 Aug 2015, 02:22 PM

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>

  

0
Dimitrina
Telerik team
answered on 27 Aug 2015, 01:54 PM
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
0
Jim
Top achievements
Rank 1
answered on 27 Aug 2015, 02:36 PM
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.
0
Dimitrina
Telerik team
answered on 27 Aug 2015, 02:44 PM
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
0
Infrastructure
Top achievements
Rank 1
answered on 12 Jul 2017, 02:46 PM

The version of my Reporting.dll is 11.0.17.406 (R1 2017 SP2).  And I got the same warning message box from Excel when I export the report to XLSX format. 

thanks,

0
Yana
Telerik team
answered on 17 Jul 2017, 11:14 AM
Hello,

Please refer to the following forum thread:
http://www.telerik.com/forums/xlsx-format-warning-message

where the same issue is discussed.

Regards,
Yana
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Peter
Top achievements
Rank 1
Jim
Top achievements
Rank 1
Infrastructure
Top achievements
Rank 1
Yana
Telerik team
Share this question
or