+ Start a Discussion
Ketan Solanki29Ketan Solanki29 

Visualforce page to export into excel ".xlsx" extension

Hi is there anyway to export into excel ".xlsx" extension using visualforce page.

 

I am using contentType = "application/vnd.ms-excel#MyFile.xlsx" but gives en error while opening a file.

 

Excel cannot open the file 'MyFile.xlsx' becuase the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.

 

Please suggest me on this.

 

Thanks,

amarcuteamarcute

Try using

 

contentType = "application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet#MyFile.xlsx"
amarcuteamarcute

There is a typo in the first post.

 

contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet#MyFile.xlsx"
Ketan Solanki29Ketan Solanki29

Still not working for me!

abdelmunem almoradiabdelmunem almoradi
Change it to MyFile.xls (make the extension .xls instead of .xlsx) and it will work!
sundhar.mks1.3962649227519546E12sundhar.mks1.3962649227519546E12
Hi abdelmunem almoradi,

I have used the contentType = "application/vnd.ms-excel. but page only downloaded not display to Vf page.

Thank's..............
 
Chetankumar JainChetankumar Jain
is anyone able to accomplish this requirement?
We also have same requirement were we are able to export to ".xls" format using contentType="application/vnd.ms-excel" but not in ".xlsx".