Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 11, 2013 02:41 AM by april_123456
Jan 10, 2013 02:17 PM|LINK
I have problem with my application. This is my code which exports data to file:
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.Charset = "";
Columns in xlWorkBook has some assigned values.
But when i try to open this "test.xlsx" file i get an error: "excel can not open the file because the file format or file extension is not valid".
Any ideas what should i change in this code? Any proposals will be highly appreciate.
Jan 10, 2013 03:09 PM|LINK
see the beginning of the excel file or the end - does it contains something unusual?
Jan 10, 2013 05:07 PM|LINK
No, everything looks fine
Jan 10, 2013 08:46 PM|LINK
After downloading test.xslx rename it to test.zip (.xslx files are actuall .zip files) You should be able to open it by double clicking. What do you see? There should be a [Content_Types].xml file and some folders (_rels, docProps, xl)
It would be useful to see what happens between the first and second lines of your code. Eg, how do you populate this workbook, do you close it properly, etc.
Is this code on your development machine? Do you realise that Microsoft neither supports nor recommends installing Office on a server and so you are unlikely to be able to publish this web site?
Jan 11, 2013 12:17 AM|LINK
try adding "default" at the end of xlWorkBook.
Try opening it after that and see if it takes.
Jan 11, 2013 02:41 AM|LINK
Hello Mat R,
With regards to your problem, please view the following:
Perhaps it will give you some aid.
Best of Luck!
With Kind Regards,