woensdag 23 maart 2011

Working with OpenDocument is really cool .. orange!

One of the features why LibreOffice en OpenOffice.org excel is the native use of the open, ISO-certified ODF file format.
ODF is evolved from the first complex XML fike format designed for office-documents, back in 2000 by the at that time very new OpenOffice.org project. One of the features of an xml based file is that the content can be read and edited as flat text. Not rather convenient for daily use; however very powerful for automated tasks and small extra tricks. I want to share an example of the last possibility here.
Basic is, that everything that you can set in a document for formatting, content end so forth, can be found in standardised xml documents. Therefore sometimes new features in your favourite ODF supporting suite, can only be implemented as a standard, once the ODF file format is extended for that use. A recent example: coloured tabs in Calc.
The other way round is possible too: there can be a feature supported by the file format, that you do not (yet) find in the user interface. This happened today, when a customer brought the requests for a new set of templates. Studying those, I saw a coloured separator for footnotes in Writer. Now it is possible to set a whole bunch of characteristics for the page style, including some of the separator for footnotes ... but not the color.
No time to bother: I took an optimistic dive in the file styles.xml, which is one of the components of the ODF container file. And there I found the property 'color' of the 'style:footnote-sep'. I changed the value "#000000" in "#FFA500", saved the xml file in the ODF file again, and the Writer document perfectly showed an orange separator on top of the foot-notes.
This is not something to do too often, but it is not problem of course to do this once for a template. Makes me feel satisfied and a customer happy :-)

2 opmerkingen:

  1. Hi Cor,

    You were pretty lucky for that particular property as everything was implemented from the ODF import / export to the document layout. Only the UI was missing and it was a matter of a few minutes to add it.

    I fixed that some days ago along with the new borders types. See this commit for more details:
    http://cgit.freedesktop.org/libreoffice/writer/commit/?id=86eb316ee96cb3bb2107401f253ddf633a3c9f58

    This will be available in LibreOffice 3.4 and I hope it'll make you even more happy!

    BeantwoordenVerwijderen
  2. Hi Cédric,

    Thanks for your comment :-)
    I was so busy with various preparations for the event and more, that we did not notice your comment before we started hacking. We had an idea, found the place in the code, and were surprised to find already vars declared, that we planned. So after that Theo was fast in finding your commit in git ;-)
    Look forward to 3.4 and more of course :-)

    BeantwoordenVerwijderen