XML is used a lot by developers, but not so much by your average person. So, quite often you'll find yourself needing to get data that was sent to you by others into an XML format. When it comes to any type of tabular data or repeating record, it is almost certain that the data will come to you in the form of a spreadsheet.
OpenOffice.org and LibreOffice have built-in capabilities to allow you to transform your spreadsheets (or any other office documents, for that matter) by writing custom XSLT filters. While this is powerful, it is also time consuming and not suitable for many tasks where you just want to get a basic export of the data. Writing a custom exporter is fine when you are targeting a specific (and fixed) output format, but it is overkill when you simply need to get arbitrary data into a well-formed XML document for further use.
This Simple XML Exporter for uses the built-in XML transformation capabilities of the application to provide a simple way to save your spreadsheet as XML. This data can then be further manipulated in any text editor to allow you to provide any tweaks necessary to get it into your desired output format.
The exporter installs into OpenOffice.org or LibreOffice and appears as an option in the File>Export dialog box from within the Calc application. The exporter will create an output file with the contents of your workbook - including all sheets that have content. Each sheet is included in the exported file within <ooo_sheet> </ooo_sheet> tags. The name of the sheet is included as an attribute to the <ooo_sheet> - to help you keep track of what sheet generated which section of output.
Each row on the sheet (after the first) is exported as a data row in your XML file, using the values from the first row in the column as the tag name. Since XML tag names have more restrictions than cell values can have - the exporter will attempt to use your tag name when it can, and will try to generate a valid name when it cannot. Quite often, the first row of a sheet already contains column names, so this is an easy way to set tag names for your output XML.
Note to LibreOffice users: Due to differences in the XSLT processor available within LibreOffice, not all XSL features are supported. This means the LibreOffice exporter cannot currently use the column header as the XML tag name. Instead, tags are named numerically, and can be renamed in a text editor (eg. <column_1>).
Choose the exporter that is right for you depending on your needs and which application suite you use.
Note: The XSL processor used in LibreOffice does not support XSLT 2.0 features. This means that the code used to generate tag names from the header row does not work. Instead, an XML file will be generated with numerically named tags (eg. <column_1>) which can be renamed by a simple search/replace in your text editor application afterward.
XML Exporter for LibreOffice (MD5: 05d7c3999ccdb077bf55018faba3ee6e)
Note: If you have a large speadsheet, the exporter may take a long time (or even hang) when generating the output file due to the way it must process the source to determine tag names. You can use the alternate exporter on larger spreadsheets for MUCH better performance. You can install both exporters on the same system at the same time. The alternate exporter will not name the tags in the output with the text from the header row, but will name them numerically (eg. <column_1>) which can be renamed by a simple search/replace in your text editor application afterward.
XML Exporter for OpenOffice.org v3 and higher (MD5: a6029000ab931ce658803e3fe7252380)
Large Spreadsheet XML Exporter for OpenOffice.org v3 and higher (MD5: 05d7c3999ccdb077bf55018faba3ee6e)
Note: Older versions of OpenOffice.org do not support all the features used by the standard exporter. You can try the alternate exporter, which does not use these features. This means that the code used to generate tag names from the header row does not work. Instead, an XML file will be generated with numerically named tags (eg. <column_1>) which can be renamed by a simple search/replace in your text editor application afterward.
XML Exporter for OpenOffice.org v2 (MD5: 05d7c3999ccdb077bf55018faba3ee6e)
To use the exporter, simply go to the File menu
and choose the Export option.
The exporter will only be visible from within Calc
since it works specifically on spreadsheet data.
Choose 'XML File' from the 'File Format' drop-down box, and enter a filename and location to save your file.
That's it.
Note: The exporter for LibreOffice, the large spreadsheet exporter for OpenOffice.org, and the exporter for legacy versions of OpenOffice.org will show up as 'XML File (numbered cols)' in the 'File Format' drop-down.
For the most part, things are pretty straight-forward and (hopefully) easy to use. There are a couple small items that need to be noted - mostly due to the way in which the XSL transformation interface accesses the "internal" structure of the document, which can cause a few minor irregularities.
Questions, comments, or any other feedback?
Email me at:
oooexport(at)digitalimprint(dot)com