Click here to Skip to main content
13,147,383 members (30,131 online)
Rate this:
Please Sign up or sign in to vote.
See more:
When i am exporting to excel file and saving it with xlsx format, it saves the file. But when i am opening the file it gives me the error as follows.

"Excel cannot open the file 'filename.xlsx' because 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."

but when i change the extension to .xls it opens the file. but the problem is if my rows are going beyond 65536 rows gets truncated after that. So that is the reason i amd saving it as .xlsx.

Is there any difference between exporting a file to excel 2003 and excel 2007 from 2008?
Posted 5-Jul-12 4:07am
aspnet_regiis 5-Jul-12 10:38am
There are thousands of ways of exporting the data to excel....How can we guess the problem unless we know what code/logic you have written?
ryanb31 5-Jul-12 11:08am
Yes, there is a huge difference. The file format for xlsx is very different which is why you can't just name it that way and have it work. If you shared the code someone could possibly offer a better solution.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Refer this MSDN link[^].
It has accepted answer.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You may have a research on this artilce: Exporting Data to Excel[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 6 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100