Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Problem creating Excel report: file is corrupted
posted

Hi all!

I am creating Excel Reports using Infragistics.Excel in an ASP.NET web service (C#). Basically, I query a database to obtain some data and later I paint the tables and insert some images (which I generate and export fo file using an UltraWebChart object) in an Excel template file, using que Infragistics component.

My problem is that sometimes when I open the created report Excel throws an error indicating that the file is corrupted (and, effectively, once opened no image is inside and any previous formatting is lost). With all the testing I've performed, I've arrived to the conclussion that the problem is in the images (I create them using an UltraWebChart, as I said). If I change the code and avoid the insertion of the images, the report that previously failed opens fine, but if I let them to be inserted then the error occurs.

I have no idea why this is happening since I can perfectly open any generated image in Windows without any error. It seems to me that the Infragistics.Excel object is not inserting properly the image in the Excel file, but only sometimes.

I've changed the type of the image file from bmp to jpeg, tiff, gif, etc. and the error is still there.

I hope I've been enough descriptive. Any help will be appreciated.