Currently all our excel sheets are being generated in Excel (1997-2003) format which is of extension .xls. These types of excel will have a problem when user have higher version of office installed. (Due to Extension Hardening Feature : A warning messages
will be dispalyed before opening the excel sheet). As per our requirment we need to generate excel sheets in .xlsx format.
We can change any file extension to .xlsx or anything we want. OS automatically will change the icon for the file to the related program icon, so we see on surface is an xlsx file with Excel icon , but actually , the file itself is not an xlsx file.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
Naresh Polu
0 Points
1 Post
Response.Contenttype for Excel 2007 or 2010 (.xlsx) format is not working
Nov 12, 2012 02:02 PM|LINK
Hi,
Currently all our excel sheets are being generated in Excel (1997-2003) format which is of extension .xls. These types of excel will have a problem when user have higher version of office installed. (Due to Extension Hardening Feature : A warning messages will be dispalyed before opening the excel sheet). As per our requirment we need to generate excel sheets in .xlsx format.
Code :
Case "EXCEL"
Response.AppendHeader("Content-Disposition","filename=" test&".xlsx") Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
I have used the correct MIME type for Excel 2007/2010 as mentioned above.
Excel file which is being generated from web site is opening in .xlsx type but i am getting below error message :
Excel cannot open the file .xlsx because the file format or file extension is not valid.Please make sure that fiel is not corrupted.
But when I tried to save the same file in .xls format, it is opening fine without any issues.
My web site is hosted in IIS 7, so b ydefault all MIME types are already added.
Can any one please help me in resolving the issue.
Thanks,
Naresh
Dalong Zhang...
Contributor
5185 Points
213 Posts
Microsoft
Re: Response.Contenttype for Excel 2007 or 2010 (.xlsx) format is not working
Nov 14, 2012 07:01 AM|LINK
Hi,
We can change any file extension to .xlsx or anything we want. OS automatically will change the icon for the file to the related program icon, so we see on surface is an xlsx file with Excel icon , but actually , the file itself is not an xlsx file.
Feedback to us
Develop and promote your apps in Windows Store