Click here to Skip to main content
15,793,624 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,
I'm able to copy HTML file content to a XLS file using this method[File.Copy()]properly. But while i'm copying HTML file content to a XLSX file, i observed its able to copy all data properly ,but its making this XLSX file curropted. SO its not able open in EXCEL 2007.Getting error as its a curropted file.

But if we manualy change the foramt of the same created XLSX file to XLS , then its able to open in OFFICE 2007(with a formal warning message as its a lower version formated).

I came to know an .xlsx file is opened strictly as a ZIP package used by 2007 office applications.So i don't feel there is any easy way to create a good XLSX file from a HTML file in C#.

So kindly please guide me if any different way to create this XLSX file.
Posted
Updated 30-Mar-11 0:56am
v3

1 solution

You can't. An XLSX file is really a .ZIP file with a bunch of files inside. Don't believe me? Take any .XLSX file and rename the file extension to .ZIP. Open it in WinZip or Explorer and peek inside.
 
Share this answer
 
Comments
pjhelp 30-Mar-11 6:03am    
Yes Dave, I came to know "an .xlsx file is opened strictly as a Zip package used by 2007 office applications." . I also followed your suggestion and observed the same.
Still i'm hoping there may be any indirect way to create an XLSX file from a HTML file.Kindly please update me if you have any new idea.
And thanks for your response.

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