Listbox to Open Document Spreadsheet (*.ods) with TT's Zip-Package

Hi everyone,

i tried to create a Listbox to .ods Converter. I use Thomas Tempelmanns “TTZip-Package” to pack all the Files into a Zip-File. After uploading the table.ods File to Google-Docs, tried to open it with Google Tables, but i got Message “unable to convert”. Why? Can’t find any error within the structure. Don’t have Open Office/Libre Office to check, if they are able to read it…

Online-Converter like Zamzar can read and convert it correctly!

Any inputs?

Sample Project

[quote=247880:@Martin Trippensee]Hi everyone,

i tried to create a Listbox to .ods Converter. I use Thomas Tempelmanns “TTZip-Package” to pack all the Files into a Zip-File. After uploading the table.ods File to Google-Docs, tried to open it with Google Tables, but i got Message “unable to convert”. Why? Can’t find any error within the structure. Don’t have Open Office/Libre Office to check, if they are able to read it…

Online-Converter like Zamzar can read and convert it correctly!

Any inputs?

Sample Project[/quote]

Why don’t you get OpenOffice at http://www.openoffice.org/ ? It is a free download. So you can test. You will also be able to generate your own .ods documents from OpenOffice to study the format.

Zamzar is nice, but better get it from the horse’s mouth.

The site also has extensive documentation available. It is possible they have the official format described.

Or just write the data as an excel workbook / work sheet
Open Office can open that

Michael, the Open Document Format is a large, large Format. At this moment i’m only interested to create the smallest working ODS-File :slight_smile:

[quote=247890:@Norman Palardy]Or just write the data as an excel workbook / work sheet
Open Office can open that[/quote]
I know Norman, but i want a platform independent solution :wink:

What i’m not understand, in past (2007) everyone was able to compress Microsoft Excel File “.xslx” by himself. It was an easy structure. But Microsoft changed the Zip-Compression to Zip64. Sad, Thomas TTZip-Package isn’t able to handle this.

Why not use Open Office to create a small test ods document and reverse engineers it, then ?

That or “read the spec write the code for it” :stuck_out_tongue:

[quote=247893:@Martin Trippensee]Michael, the Open Document Format is a large, large Format. At this moment i’m only interested to create the smallest working ODS-File :slight_smile:

I know Norman, but i want a platform independent solution ;)[/quote]
Just trying to give you something that you can work with today - literally
In 20 minutes you could be writing a spreadsheet and excel, numbers or open office on any platform can open it
Sounds plenty “independent” to me

That was what I suggested, and what I would do myself (if Christian does not have a plugin), but it seems Martin dismissed that : [quote]Michael, the Open Document Format is a large, large Format. [/quote]

Well, it is HIS project. Who are we to prevent him to enjoy the puzzle ? It is HIS karma after all :stuck_out_tongue:

And there is a free solution to write the data to an excel workbook that openoffice numbers and excel can open

The ODF format is huge but if you’re just writing one you can do a minimal set
Its just a zip file with contents that are easily examined

@Michel Bujardet : I read the specs :wink:

So i found this article about the first item of the Zip-Directory. TT’s Zip-Package compress every item automatically. But if you read this article, you’ll see, the first file entry of the directory "mimetype" shouldn’t be compressed. Ok…But a exported Google-Docs ODS-File hasn’t any "mimetype" File inside, but it’s also valid - ??? Don’t understand why.

@Norman Palardy : You are right, it’s not hard to understand the ODS-Structure…should be simple to create an easy ODS-Structure. But it doesn’t make sense, if the compressed File isn’t valid :confused: Checkt the file headers with HexEd.it/

Why i wanna use TT’s-Zip-Package? I want a platform independent solution :wink:

To me, ods is the format created by Open Office. ODF is another thing. I maybe mistaken, though.

The ods subset seems fairly straightforward as described here :
http://www.codeproject.com/Articles/38425/How-to-Read-and-Write-ODF-ODS-Files-OpenDocument-S

So, after more experiences with TT’s Zip-Package i feel like running into an endless circle :confused:
I found the following class: PHP to .ods on Github.
I checked the exportOds-Method within the class and its exactly the same, like i do it with TT’s Zip-Package, but the result is everytime an invalid .ods file. WHY?
[h]PHP-Code[/h]

$zip->addEmptyDir('Thumbnails'); $zip->addFromString('mimetype', 'application/vnd.oasis.opendocument.spreadsheet'); $zip->addFromString('settings.xml', $this->getSettings()); $zip->addFromString('content.xml', $this->getContent()); $zip->addFromString('meta.xml', $this->getMeta()); $zip->addFromString('styles.xml', $this->getStyle()); $zip->addEmptyDir('META-INF'); $zip->addFromString('META-INF/manifest.xml', $this->getManifest());

TT’s Zip-Package has analog ZipFolderItem Methods!

First thing I would try is to :

  • create a small test document,
  • save it as ods,
  • Unpack it
  • recompact it with TTZip.

If it is recognized as valid, then TTZip is just fine, and something is wrong with the format of your XML.