{"id":21637,"library":"odfdo","title":"odfdo - Python library for OpenDocument Format","description":"A Python library to create, read, and manipulate OpenDocument Format (ODF) files (ODT, ODS, ODP). Version 3.22.6 supports Python >=3.10, <4. Active development, frequent releases.","status":"active","version":"3.22.6","language":"python","source_language":"en","source_url":"https://github.com/jdvorak/odfdo","tags":["ODF","OpenDocument","document generation","ODT","ODS","ODP"],"install":[{"cmd":"pip install odfdo","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"XML parsing and serialization required for ODF manipulation.","package":"lxml","optional":false}],"imports":[{"note":"Top-level import works.","wrong":"","symbol":"Document","correct":"from odfdo import Document"},{"note":"Top-level import works.","wrong":"","symbol":"Paragraph","correct":"from odfdo import Paragraph"},{"note":"In v3.x, Style classes moved to submodule.","wrong":"from odfdo import Style","symbol":"ParagraphStyle","correct":"from odfdo.style import ParagraphStyle"},{"note":"Deprecated flat import, but still works (will be removed in future).","wrong":"from odfdo import Element","symbol":"Element","correct":"from odfdo.element import Element"}],"quickstart":{"code":"from odfdo import Document, Paragraph\nfrom odfdo.style import ParagraphStyle\n\n# Create a new text document\ndoc = Document('text')\nbody = doc.body\n\n# Add content\nbody.append(Paragraph('Hello, ODF!'))\n\n# Save\ndoc.save('hello.odt')\nprint('Document created.')\n","lang":"python","description":"Creates a simple ODT file with a paragraph."},"warnings":[{"fix":"Use nested imports: `from odfdo.element import Element`, `from odfdo.style import ParagraphStyle`, etc.","message":"In version 3.x, many import paths changed from flat to nested (e.g., `from odfdo import Document` works, but `from odfdo.style import ParagraphStyle` is now required instead of `from odfdo import Style`).","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Use `from odfdo.element import Element`.","message":"The `from odfdo import Element` top-level import is deprecated as of v3.6. Prefer `from odfdo.element import Element`.","severity":"deprecated","affected_versions":">=3.6.0"},{"fix":"Use lowercase strings: 'text', 'spreadsheet', 'presentation'.","message":"When creating a document, specifying the type as a string (e.g., 'text', 'spreadsheet', 'presentation') is required; omitting it or using wrong case raises `ValueError`.","severity":"gotcha","affected_versions":"all"},{"fix":"Always import and instantiate specific elements like `from odfdo import Paragraph`.","message":"The `body` property returns a generic `Element`. To append content, use `body.append()` but ensure the appended element is a valid ODF element (e.g., Paragraph, Table).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install odfdo` in the correct environment (e.g., virtualenv).","cause":"Library not installed or installed for wrong Python environment.","error":"ModuleNotFoundError: No module named 'odfdo'"},{"fix":"Use `from odfdo.style import ParagraphStyle` or `from odfdo.style import Style`.","cause":"In v3.x, Style was moved to `odfdo.style`.","error":"ImportError: cannot import name 'Style' from 'odfdo'"},{"fix":"Use `doc.save('filename.odt')`.","cause":"Misspelled method `save`; correct is `save` (lowercase).","error":"AttributeError: 'Document' object has no attribute 'save'"},{"fix":"Use `Document('text')` instead of `Document('Text')`.","cause":"Document type must be lowercase: 'text', 'spreadsheet', or 'presentation'.","error":"ValueError: Unknown document type 'Text'"},{"fix":"Use `body.append(...)` not `body(...)`.","cause":"Trying to call an Element instance as a function, likely misusing `body()` instead of `body.append()`.","error":"TypeError: 'odfdo.element.Element' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}