Documentation/ODF documents generation tools

    From The Document Foundation Wiki
    Other languages:

    Development Resources

    Development TDF portal: https://wiki.documentfoundation.org/Development

    To learn about ODF files, you can read the ODF Markup article.

    ODF document generation tools

    Python

    odfdo
    odfpy
    odsgenerator
    odpdown

    Java

    ODF Toolkit

    Official TDF project, collaboration with Apache

    PHP

    PHPOffice

    Third party project, actively maintained. The main developer (Franck Lefevre) had contacted the French-speaking community of LibreOffice through his Twitter account in order to ask questions to an ODF guru. Contacting Svante Schubert, working for CIB, was recommended to him.

    OpenTBS

    Active project, plugin for TinyButStrong but usable without TinyButStrong. Very easy to use, no installation, only two php files containing the classes are needed. Based on user-defined templates.

    JavaScript

    WebODF

    JavaScript library to render an ODF document using HTML and CSS. Initially developed by KO GmbH.

    XmlRPC

    Nexedi cloudooo

    Http

    NDCODFAPI Project

    LibreOffice

    It is also possible to generate ODF documents running LibreOffice on a server. A LibreOffice process will be able to execute a macro which will itself generate one or more documents, for example via a merge. To call a macro on a Linux server for execution without a GUI :

       libreoffice --nofirststartwizard --norestore --headless --invisible  "macro:///bibliothèque.module.macro(arg1,arg2...)"
    

    Generic method, based on standard Python packages

    The ODF standard consists in making a compressed file (by ZIP), which contains various data, most of them in XML format. There is no reason why a generic tool for handling XML should be discarded. Of course, this assumes that the person writing a script knows what XML is, what trees, subtrees, nodes, attributes, etc. are. A good way to work is to start from a template file, which already contains the constant parts of the document to be generated, with the right styles, and a suitable structure, and then create a lightweight script next to it that retrieves data from elsewhere, and uses the DOM tree of the template to generate an elaborate document. Thus, one easily separates the form (in the template) from the content (the data processing).

    zipfile package

    The Python zipfile package allows you to open .odt, .ods, .odg, etc. files and to access their contents, in particular the content.xml file that encodes the content of the document, the Pictures directory that contains the images, etc.

    xml.dom.minidom package

    With the minidom class, it is easy to open the content.xml file and analyze its contents in the form of a syntax tree (the DOM tree). When you have this tree, you can find a particular branch, delete it, or modify it, or make copies of it and graft them to the tree before or after another branch.