July 2010 Archives

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

About this Archive

This page is an archive of entries from July 2010 listed from newest to oldest.

June 2010 is the previous archive.

February 2011 is the next archive.

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