Development Resources

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

Python

odfpy

https://pypi.org/project/odfpy/

https://github.com/eea/odfpy

https://github.com/eea/odfpy/wiki

Active maintenance (although few releases)

last release: 2020-01-18

examples: https://github.com/eea/odfpy/tree/master/examples

not specifically provided for merging but may do so, examples could be provided

odpdown

https://github.com/thorstenb/odpdown

Not actively maintained

last release: 2015-03-13

Java

ODF Toolkit

Official TDF project, collaboration with Apache

https://github.com/tdf/odftoolkit

https://odftoolkit.org/index.html

active maintenance

last release: 2019-10-06

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.

https://github.com/PHPOffice/ PhpSpreadSheet PhpWord PhpPresentation, PhpProject & PhpVisio

active maintenance

last release: 2019-12-02

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.

https://www.tinybutstrong.com/opentbs.php?doc

active maintenance

last release: 2019-06-17

JavaScript

WebODF

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

XmlRPC

Nexedi cloudooo

https://github.com/nexedi/cloudooo

https://lab.nexedi.com/nexedi/cloudooo

active maintenance (although few releases)

last update: 2020-01-02

no examples

not specifically provided for merging but may do so

used by Libriciel for WEBDELIB (generation of deliberations for local governments)

Http

NDCODFAPI Project

https://github.com/NDCODF/ndcodfapi_service

active maintenance

last release: 2019-09-05

documentation: https://github.com/NDCODF/ndcodfapi_service/blob/master/Developer_Guide.md The documentation is not fully translated into English.



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.