odfdo


Nameodfdo JSON
Version 3.15.1 PyPI version JSON
download
home_pageNone
SummaryPython library for OpenDocument Format
upload_time2025-07-26 10:55:06
maintainerNone
docs_urlNone
authorNone
requires_python<4,>=3.9
licenseNone
keywords odf opendocument library python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # odfdo

[![Release](https://img.shields.io/github/v/release/jdum/odfdo)](https://img.shields.io/github/v/release/jdum/odfdo)
[![Build Status](https://img.shields.io/github/actions/workflow/status/jdum/odfdo/main.yml?branch=devel)](https://img.shields.io/github/actions/workflow/status/jdum/odfdo/main.yml?branch%3Adevel)
[![License](https://img.shields.io/github/license/jdum/odfdo)](https://img.shields.io/github/license/jdum/odfdo)
[![PyPI Downloads](https://static.pepy.tech/badge/odfdo/month)](https://pepy.tech/projects/odfdo)

OpenDocument Format (ODF, ISO/IEC 26300) library for Python

![logo](https://raw.githubusercontent.com/jdum/odfdo/master/odfdo.png)

`odfdo` is a Python library for programmatically creating, parsing, and editing OpenDocument Format (ODF) files.  It provides an interface for interacting with `.odt`, `.ods`, `.odp`, and other ODF file types. The library comes with a set of utilities and recipes for common actions to make it easier to use.

-   Document Creation: Generate new ODF documents.
-   Content Manipulation: Add, modify, or delete text, paragraphs or tables.
-   Table Operations: Create, populate, and modify tables.
-   Style Management: Control formatting through different ways.
-   Drawing and Presentation: Less advanced features, but allow work with elements in `.odg` and `.odp` files.
-   Metadata: Read and write document metadata.

Project:
[https://github.com/jdum/odfdo](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):

```bash
pip install odfdo
```

Installation from sources:

```bash
uv sync
```

After installation from sources, you can check everything is working. The tests should run for a few seconds and issue no error.

```bash
uv sync --dev
uv run pytest
```

To generate the documentation in the `./docs` directory:

```bash
uv sync --group doc
uv run python doc_src/generate_doc.py
```

A special effort has been made to limit the dependencies of this library: the only (non-development) dependency is `lxml`. Versions of `lxml` depend mainly on the version of Python used; see the `pyproject.toml` file for details.


# Usage Overview

## Creating a "Hello world" Text Document

```python
from odfdo import Document, Paragraph

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

doc.save("hello.odt")
```

## Modifying a Spreadsheet

```python
from odfdo import Document

doc = Document('existing_spreadsheet.ods')
sheet = doc.body.get_table(0)

print(f"Value of A1: {sheet.get_cell('A1').value}")
sheet.set_value('B2', 'Updated Value')

doc.save('modified_spreadsheet.ods')
```

## Utilities

A few scripts are provided with `odfdo`:

-   `odfdo-diff`: show a _diff_ between two .odt document.
-   `odfdo-folder`: convert standard ODF file to folder and files, and reverse.
-   `odfdo-headers`: print the headers of an ODF file.
-   `odfdo-highlight`: highlight the text matching a pattern (regex) in an ODF file.
-   `odfdo-markdown`: export text document in Markdown format to stdout.
-   `odfdo-replace`: find a pattern (regex) in an ODF file and replace by some string.
-   `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-table-shrink`: shrink tables to optimize width and height.
-   `odfdo-userfield`: show or set the user-field content in an ODF file.


# tl;dr

'Intended Audience :: Developers'

# Documentation

-   the `recipes` folder contains more than 60 working sample scripts,
-   the auto-generated documentation exposes public APIs and recipes.

Online documentation: [https://jdum.github.io/odfdo](https://jdum.github.io/odfdo/)

# 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.
Several recipes provide an example of manipulating styles, including: `change_paragraph_styles_methods.py`,`create_basic_text_styles`, `add_text_span_styles`.


# Related project

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


# Former lpod-python 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 former project to Python 3.x with several improvements.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "odfdo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": "ODF, OpenDocument, library, python",
    "author": null,
    "author_email": "J\u00e9r\u00f4me Dumonteil <jerome.dumonteil@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/08/4c/ba91822cad5562d091dcf3c47ff42252415d4bf8e4ac921052a27d55c193/odfdo-3.15.1.tar.gz",
    "platform": null,
    "description": "# odfdo\n\n[![Release](https://img.shields.io/github/v/release/jdum/odfdo)](https://img.shields.io/github/v/release/jdum/odfdo)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/jdum/odfdo/main.yml?branch=devel)](https://img.shields.io/github/actions/workflow/status/jdum/odfdo/main.yml?branch%3Adevel)\n[![License](https://img.shields.io/github/license/jdum/odfdo)](https://img.shields.io/github/license/jdum/odfdo)\n[![PyPI Downloads](https://static.pepy.tech/badge/odfdo/month)](https://pepy.tech/projects/odfdo)\n\nOpenDocument Format (ODF, ISO/IEC 26300) library for Python\n\n![logo](https://raw.githubusercontent.com/jdum/odfdo/master/odfdo.png)\n\n`odfdo` is a Python library for programmatically creating, parsing, and editing OpenDocument Format (ODF) files.  It provides an interface for interacting with `.odt`, `.ods`, `.odp`, and other ODF file types. The library comes with a set of utilities and recipes for common actions to make it easier to use.\n\n-   Document Creation: Generate new ODF documents.\n-   Content Manipulation: Add, modify, or delete text, paragraphs or tables.\n-   Table Operations: Create, populate, and modify tables.\n-   Style Management: Control formatting through different ways.\n-   Drawing and Presentation: Less advanced features, but allow work with elements in `.odg` and `.odp` files.\n-   Metadata: Read and write document metadata.\n\nProject:\n[https://github.com/jdum/odfdo](https://github.com/jdum/odfdo)\n\nAuthor:\njerome.dumonteil@gmail.com\n\nLicense:\nApache License, Version 2.0\n\n`odfdo` is a derivative work of the former `lpod-python` project.\n\n# Installation\n\nInstallation from Pypi (recommended):\n\n```bash\npip install odfdo\n```\n\nInstallation from sources:\n\n```bash\nuv sync\n```\n\nAfter installation from sources, you can check everything is working. The tests should run for a few seconds and issue no error.\n\n```bash\nuv sync --dev\nuv run pytest\n```\n\nTo generate the documentation in the `./docs` directory:\n\n```bash\nuv sync --group doc\nuv run python doc_src/generate_doc.py\n```\n\nA special effort has been made to limit the dependencies of this library: the only (non-development) dependency is `lxml`. Versions of `lxml` depend mainly on the version of Python used; see the `pyproject.toml` file for details.\n\n\n# Usage Overview\n\n## Creating a \"Hello world\" Text Document\n\n```python\nfrom odfdo import Document, Paragraph\n\ndoc = Document('text')\ndoc.body.append(Paragraph(\"Hello world!\"))\n\ndoc.save(\"hello.odt\")\n```\n\n## Modifying a Spreadsheet\n\n```python\nfrom odfdo import Document\n\ndoc = Document('existing_spreadsheet.ods')\nsheet = doc.body.get_table(0)\n\nprint(f\"Value of A1: {sheet.get_cell('A1').value}\")\nsheet.set_value('B2', 'Updated Value')\n\ndoc.save('modified_spreadsheet.ods')\n```\n\n## Utilities\n\nA few scripts are provided with `odfdo`:\n\n-   `odfdo-diff`: show a _diff_ between two .odt document.\n-   `odfdo-folder`: convert standard ODF file to folder and files, and reverse.\n-   `odfdo-headers`: print the headers of an ODF file.\n-   `odfdo-highlight`: highlight the text matching a pattern (regex) in an ODF file.\n-   `odfdo-markdown`: export text document in Markdown format to stdout.\n-   `odfdo-replace`: find a pattern (regex) in an ODF file and replace by some string.\n-   `odfdo-show`: dump text from an ODF file to the standard output, and optionally styles and meta informations.\n-   `odfdo-styles`: command line interface tool to manipulate styles of ODF files.\n-   `odfdo-table-shrink`: shrink tables to optimize width and height.\n-   `odfdo-userfield`: show or set the user-field content in an ODF file.\n\n\n# tl;dr\n\n'Intended Audience :: Developers'\n\n# Documentation\n\n-   the `recipes` folder contains more than 60 working sample scripts,\n-   the auto-generated documentation exposes public APIs and recipes.\n\nOnline documentation: [https://jdum.github.io/odfdo](https://jdum.github.io/odfdo/)\n\n# About styles\n\nThe best way to apply style is by merging styles from a template\ndocument into your generated document (See `odfdo-styles` script).\nStyles are a complex matter in ODF, so trying to generate styles programmatically is not recommended.\nSeveral recipes provide an example of manipulating styles, including: `change_paragraph_styles_methods.py`,`create_basic_text_styles`, `add_text_span_styles`.\n\n\n# Related project\n\nI you work on `.ods` files (spreadsheet), you may be interested by these scripts using\nthis library to parse/generate `.ods` files:\n[https://github.com/jdum/odsgenerator](https://github.com/jdum/odsgenerator) and [https://github.com/jdum/odsparsator](https://github.com/jdum/odsparsator)\n\n\n# Former lpod-python library\n\n`lpod-python` was written in 2009-2010 as a Python 2.x library,\nsee: `https://github.com/lpod/lpod-python`\n\n`odfdo` is an adaptation of this former project to Python 3.x with several improvements.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library for OpenDocument Format",
    "version": "3.15.1",
    "project_urls": {
        "changelog": "https://github.com/jdum/odfdo/blob/master/CHANGES.md",
        "documentation": "https://jdum.github.io/odfdo/",
        "homepage": "https://github.com/jdum/odfdo",
        "repository": "https://github.com/jdum/odfdo"
    },
    "split_keywords": [
        "odf",
        " opendocument",
        " library",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "67678cf240cd0980f9d810fa706746d3b3db04411e0c539f3af02585faa55ea2",
                "md5": "fded6377022eca74fc954bea552df1f4",
                "sha256": "066b7f6b68320be705e23e3cadd37c511b735415daf71dffc3c663ea4a9adfcf"
            },
            "downloads": -1,
            "filename": "odfdo-3.15.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fded6377022eca74fc954bea552df1f4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 271182,
            "upload_time": "2025-07-26T10:55:03",
            "upload_time_iso_8601": "2025-07-26T10:55:03.879841Z",
            "url": "https://files.pythonhosted.org/packages/67/67/8cf240cd0980f9d810fa706746d3b3db04411e0c539f3af02585faa55ea2/odfdo-3.15.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "084cba91822cad5562d091dcf3c47ff42252415d4bf8e4ac921052a27d55c193",
                "md5": "882624abb34a04868d62947a5114deb7",
                "sha256": "595aabbcf8bc40b6d848243678953cd78ffdcf0e2bd17c1453f9a38b33174094"
            },
            "downloads": -1,
            "filename": "odfdo-3.15.1.tar.gz",
            "has_sig": false,
            "md5_digest": "882624abb34a04868d62947a5114deb7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 3248517,
            "upload_time": "2025-07-26T10:55:06",
            "upload_time_iso_8601": "2025-07-26T10:55:06.753565Z",
            "url": "https://files.pythonhosted.org/packages/08/4c/ba91822cad5562d091dcf3c47ff42252415d4bf8e4ac921052a27d55c193/odfdo-3.15.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-26 10:55:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jdum",
    "github_project": "odfdo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "odfdo"
}
        
Elapsed time: 0.84254s