Connecting Tech Pros Worldwide Help | Site Map

Writing to xlsx files

Newbie
 
Join Date: Jan 2009
Location: South Africa
Posts: 6
#1: Jan 7 '09
Hi, I am trying to write to data to a .xlsx file(Excel 2007). I can currently write the data to a .xls file. I tried to change the extension of the xls file (to xlsx) but Excel gave the following error:Excel cannot open the file 'Filename.xlsx' because the file format or file extent ion is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.
I know Excel(2007) can open the xls file but I would like to save the data directly to a xlsx file.
Is it possible?, if not is there a way to automatically convert the file from the xls format to the xlsx format?
Any advice would be greatly appreciated
Thanks in advance
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: Jan 7 '09

re: Writing to xlsx files


XLS and XSLX are two different file formats. you have to convert xls to xlsx to open the latter correctly. you can use for that Microsoft's own converter or get the appropriate OpenXML Doc for spreadsheets and rewrite your xls converter.

regards
Newbie
 
Join Date: Jan 2009
Location: South Africa
Posts: 6
#3: Jan 7 '09

re: Writing to xlsx files


OK I do it that way
Thank for the quick reply and help
skitsanos's Avatar
Newbie
 
Join Date: Jan 2009
Location: Bucharest, Romania
Posts: 3
#4: Jan 9 '09

re: Writing to xlsx files


XSLX is just a Zip archive, you can open it programmaticaly with any library available for you, inside of it you willfind your XML source with data. To understand this format in depth just rename .xlsx extension into .zip and extract content on disk and just go through files you will see there. This will help you a lot. This valid for all Microsoft Office 2007 file formats.
Reply