Click here to Skip to main content
15,744,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Expert I created excel file using Open XML SDK 2.0 and open, it is successfully open.
but when user download this file and open, it cannot open. Error message comes file "Excel found unreadable content myExcel.xlsx do you want to open" when i clicked on yes show message ="the file is corrupt and cannot be opened."
please tell me how to make downloading functionality for this type of file

My downloading code:

FileInfo _file = new FileInfo(file);
            if (_file.Exists)
                Response.AddHeader("content-disposition", "attachment; filename=" + _file.Name);
                Response.AddHeader("Content-Type", "application/Excel");
                Response.ContentType = "application/vnd.xlsx";
                Response.AddHeader("Content-Length", file.Length.ToString());

thanx in advanced.....
Prasad Khandekar 29-May-13 10:16am    
Have you checked the size of downloaded file? Not related to your problem, though I would like you to read this article as well. (

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900