I have a SSRS report in SQL Server 2012 which exports to Word and PDF which open in respective readers. However when i open the XLS file in MS-Excel i get the message asking if it should repair the corrupted file. If i click yes, it shows an empty file with the message as below. I am using SQL Server 2012. This happens for data of one particular day only.
Replaced Part: /xl/worksheets/sheet1.xml part with XML error. Illegal xml character. Line 14, column 6935.
I guess i have to study this post http://christianspecht.de/2014/01/14/excel-found-unreadable-content-when-exporting-a-reporting-services-report/
Recover only Data from Corrupt Spreadsheet. 1 Click on Open under the File. 2 Select the XLSX file which you want to repair. 3 Right Click on that XLSX file and click on Copy. 4 Now Click on Cancel and open a New Excel Sheet. 5 In the first cell type !A1 and press Enter.
Specifically exporting a report where it produces a corrupt Excel .xls or .xlsx file. The cause of my particular problem was just a little .JPEG image back button, but equally it could be something like a project logo image, something that typically appears on many reports.
If there are any errors in the data the Excel file will throw the corrupt error instead of just treating those errors as text. Using the replace errors function in Power Query resolved the issue and the Excel export is fine now.
Equally having LF, CR or other non ASCII characters in the data can cause also exports to Excel to break. If you put this snippet in the "Visibility"- "Hidden" section "= (Globals!RenderFormat.IsInteractive = False)" it will still display the image when you run the report, but it stop the export corruption.
I had the same issue and in my case it was problem with data precision. Apparently SSRS is not able to process 18 decimal places and my procedure returned this data for some of the fields. That what probably happens in your case. The data for a specific day just end up with a value that has too many decimal places to process by the SSRS.
One option is to change data type in the table to support lower precision. Other solution is to convert the numbers in the stored procedure that populates the report.
SELECT CONVERT(NUMERIC(38,8),MyNumber) AS MyNumber_v2
You can read more about this bug here.
I also encountered the same issue mine was caused by an embedded image. BTW I know that this response is very late, however it may be some use for others going through similar problems with SSRS reports. Specifically exporting a report where it produces a corrupt Excel .xls or .xlsx file. The cause of my particular problem was just a little .JPEG image back button, but equally it could be something like a project logo image, something that typically appears on many reports. After much hunting down many blind alleys (from my perspective) as there are multiple reasons for the corruptions. My error message mentioned a problem with drawing.xml, which pointed me in the direction of my embedded image. Equally having LF, CR or other non ASCII characters in the data can cause also exports to Excel to break.
If you put this snippet in the "Visibility"- "Hidden" section "=(Globals!RenderFormat.IsInteractive = False)" it will still display the image when you run the report, but it stop the export corruption.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With