tags:

views:

606

answers:

3

Simple question. Does anyone know an easy way to convert SpreadsheetML (Excel 2003 XML) to the Open Document XML used for Excel 2007 (xlsx) files?

I've got a library that unfortunately doesn't read the XML format, so I need to try and find a way to read the data, that doesn't involve another library.

Any suggestions appreciated.

+1  A: 

An easy way would be to use Excel's COM Library (Excel 2007), but I think that's not the answer you are looking for.

What's your library capable of? You could use the Open XML SDK 2.0 to write the spreadsheet document based on the output of your library.

Best Regards

Oliver Hanappi
Just checked that out but unfortunately not, as we currently have to build against .NET 2.0
Ian
A: 

Hi,

IIRC the Office 2003 format works like OpenDocument format: It's a ZIP file with XML files inside, so (if you have enough time/courage) you can open it, find the XML file that contains the data and finally deal with XML.

I know, this answer is for brave developers ;)

Regards.

ATorras
However the XML within the XLSX zip file appears to differ quite significantly from the XML within the Excel 2003 XML format.
Ian
I'm afraid that's a "feature" from M$ guys, but you are there to fill the gap ;)
ATorras
A: 

The file format has indeed changed significantly from SpreadsheetML to Office Open XML.

And, since now spreadsheet files are broken into multiple XML files (which are all then zipped), there's no real hope of an easy XLST solution.

The most straightforward course of action, unfortunately, is to automate Excel using a macro to open each SpreadsheetML files and do a "Save As" to the newer format. This can be done in Office 2003 with the Office 2007 file format plug-in. Perhaps this can be relegated to a batch process so the server is not directly involved?

If the data in the spreadsheets are trivial and follow a consistent format, you can write your own parser to import directly from the SpreadsheetML files.

richardtallent
Think we might have to do them manually, and just place certain restrictions on the user depending on if its automated or not. Thanks
Ian