Producing ODF spreadsheets

| No Comments | No TrackBacks
So I asked the LazyWeb what was the minimum boilerplate to produce a ODF spreadsheet and got no answer. So here is my jorney.

Long story short: I have a XML database, I need to take data out and send to a customer in a user-friendly format, the data-set is too big for the OpenOffice html parser to be nice, so I decided to produce the .ods file on my own.

How does an ODF file look like? well, it's just a zip file with some standard metadata and a content.xml file. How to have an easy boilerplate for the zip file? Simple save an empty spreadsheet in calc and then replace the content.xml file inside it.

So, the remaining question is: How to produce the ODF XML?

What I did was, open the original content.xml and start to strip away anything that seemed useless. Repeat it untill things stop working.

So this is an unoficial guide for people writing ODF spreadsheet documents on their own. This is the bare minimum XML I got:


<?xml version="1.0" encoding="UTF-8"?>
<office:document-content
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
office:version="1.1">

<office:body>
<office:spreadsheet>

<table:table table:name="Minha Planilha">

<table:table-row>
<table:table-cell>
<text:p>a</text:p>
</table:table-cell>
<table:table-cell>
<text:p>1</text:p>
</table:table-cell>
</table:table-row>

<table:table-row>
<table:table-cell>
<text:p>b</text:p>
</table:table-cell>
<table:table-cell>
<text:p>2</text:p>
</table:table-cell>
</table:table-row>

</table:table>

</office:spreadsheet>
</office:body>
</office:document-content>
Enhanced by Zemanta

No TrackBacks

TrackBack URL: http://daniel.ruoso.com/cgi-bin/mt/mt-tb.cgi/216

Leave a comment

About this Entry

This page contains a single entry by Daniel Ruoso published on July 20, 2010 4:42 PM.

Transactional and Authorized Methods in your Catalyst Model Class was the previous entry in this blog.

Art? Garbage? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.