Skip to main content

Python library for OpenDocument Format

Project description

odfdo

Python library for OpenDocument format (ODF)

logo

odfdo is a Python3 library implementing the ISO/IEC 26300 OpenDocument Format standard.

Project: https://github.com/jdum/odfdo

Author: jerome.dumonteil@gmail.com

License: Apache License, Version 2.0

odfdo is a derivative work of the former lpod-python project.

Installation

Installation from Pypi (recommended):

pip install odfdo

Installation from sources (requiring setuptools):

pip install .

After installation from sources, you can check everything is working (some requirements: pytest, Pillow, ...):

pytest

The tests should run for a few seconds or minutes and issue no error.

Usage

from odfdo import Document, Paragraph

doc = Document('text')
doc.body.append(Paragraph("Hello world!"))
doc.save("hello.odt")

tl;dr

'Intended Audience :: Developers'

Documentation

There is no detailed documentation or tutorial, but:

  • the recipes folder contains more than 50 working sample scripts,
  • the doc folder contains an auto generated documentation.

When installing odfdo, 5 scripts are installed:

  • odfdo-diff: show a diff between two .odt document.
  • odfdo-folder: convert standard ODF file to folder and files, and reverse.
  • odfdo-show: dump text from an ODF file to the standard output, and optionally styles and meta informations.
  • odfdo-styles: command line interface tool to manipulate styles of ODF files.
  • odfdo-replace: find a pattern (regex) in an ODF file and replace by some string.

About styles: the best way to apply style is by merging styles from a template document into your generated document (See odfdo-styles script). Styles are a complex matter in ODF, so trying to generate styles programmatically is not recommended.

Limitations

odfdo is intended to facilitate the generation of ODF documents, nevertheless a basic knowledge of the ODF format is necessary.

ODF document rendering can vary greatly from software to software. Especially the "styles" of the document allow an adaptation of the rendering for a particular software.

The best (only ?) way to apply style is by merging styles from a template document into your generated document.

Related project

I you work on .ods files (spreadsheet), you may be interested by these scripts that use this library to parse/generate .ods files: https://github.com/jdum/odsgenerator and https://github.com/jdum/odsparsator

Changes from former lpod library

lpod-python was written in 2009-2010 as a Python 2.x library, see: https://github.com/lpod/lpod-python

odfdo is an adaptation of this formaer project. odfdo main changes from lpod:

  • odfdo requires Python version 3.9 to 3.12. For Python 3.6 to 3.8 see previous releases.
  • API change: more pythonic.
  • include recipes.
  • use Apache 2.0 license.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odfdo-3.5.0.tar.gz (172.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odfdo-3.5.0-py3-none-any.whl (205.4 kB view details)

Uploaded Python 3

File details

Details for the file odfdo-3.5.0.tar.gz.

File metadata

  • Download URL: odfdo-3.5.0.tar.gz
  • Upload date:
  • Size: 172.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for odfdo-3.5.0.tar.gz
Algorithm Hash digest
SHA256 e2c48f7b7e28c7915e47266e4ac08eccf57920b0682c02671a8bee7bc8aa4286
MD5 dae8737f71a753ddbc3a41c15810805b
BLAKE2b-256 72cfa7dff968c77182d32620168c62d9608789635117e7682d9bc99ffee87242

See more details on using hashes here.

File details

Details for the file odfdo-3.5.0-py3-none-any.whl.

File metadata

  • Download URL: odfdo-3.5.0-py3-none-any.whl
  • Upload date:
  • Size: 205.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for odfdo-3.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be4037d685261f0d6d10ac7435b649c758e3fe2fc547b45bf1dc1a299795a75d
MD5 de9bf1d4beaf6bb6e1e9732cac82af69
BLAKE2b-256 64012e9327cb5bca6c6e1bb12141a2378799edae488bc98bd0efdc28afecbc75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page