
|
The Colophon![]() Source BigFoto.com
This article explains how to use the Ruby program to convert your own OpenOffice.org documents, and also provides an overview of how I prepare documents for my clients.
Using Styles, User Fields and Master DocumentsFirst of all, I create a cover document, which provides the cover page. I usually create one for each client, so that the document will have the same 'look and feel' as for documents that the client provides. This is the Syger cover document:
![]() Each line of text has its own style. The text with grey background are user fields, which the master document will substitute with its own values.
The remaining components of the final document will be the actual contents, which may be one or more articles. As an example, I have used this article itself.
I create the master document and then insert the cover and article documents. The master document allows me to change the styles and user fields, without having to modify the original document. By changing the user fields and styles, the master document cover page looks like this:
![]() To see the various tricks I use, you can download the documents, and the final PDF file, from this zipped archive file (about 500 KB).
The Ruby ProgramObviously, the same technique could be used to produce a series of XHTML documents from a single master document. I had already done something similar, by adapting Writer2Latex, a Java program written by Henrik Just, way back when OpenOffice.org had not adopted the OpenDocument standard.
However, I didn't want to rework those modifications for the new document format, and I was looking for a good exercise to learn the Ruby programming language. A quick search came up with J. David Eisenberg's odt_to_xhtml program. It didn't go as far as I wanted to go, but it is an great utility, and the code provided an excellent framework for further enhancement.
I refactored the code, and created a new utility, odm_to_xhtml, which converts the documents referenced in a master document. Both utilities can be found in the Odt2Xhtml project.
Apart from the actual conversion, odm_to_xhtml can add extra HTML using templates, create a table of contents, and tagged contents, and now has RSS feeds too.
Caveat EmptorConverting from a rich format, such as OpenDocument, to a simpler format such as XHTML/CSS means that some things may get oversimplified, and some, such as text flow in multiple columns, can be impossible.
As such, the program remains an alpha version, since I occasionally make modifications when noticeable formatting errors appear.
DownloadsThe Odt2Xhtml project can be downloaded here as a zipped archive file (about 600 KB). The latest version is 20_03_08. As for J. David Eisenberg's program, the project is licensed according to the GNU Lesser General Public License. Installation instructions are given in the documentation provided.
|
Tag cloud: |