Skill

Automate Document Creation and Conversion

Creates, converts, and automates LibreOffice Writer (ODT) documents via soffice CLI, UNO/odfpy Python, and mail merge templates.

Works with libreoffice

71
Spark score
out of 100
Updated last month
Version 15.8.0

Add to Favorites

Why it matters

Streamline document management by automating the creation, editing, and conversion of ODT documents. This skill handles batch operations, template-based generation, and format transformations to various file types.

Outcomes

What it gets done

01

Create new ODT documents from scratch or templates

02

Convert documents between ODT, DOCX, PDF, HTML, RTF, and TXT formats

03

Automate document generation using mail merge and templates

04

Perform batch document processing and content manipulation

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-writer | bash

Overview

LibreOffice Writer

Creates, converts, and automates LibreOffice Writer ODT documents via the soffice CLI, UNO and odfpy Python scripting, mail merge against external data sources, batch format conversion, and lightweight XML-templated document generation. Use when creating, converting, mail-merging, or batch-automating documents in LibreOffice Writer's ODT format.

What it does

Covers creating, editing, converting, and automating document workflows in LibreOffice Writer's native ODT (OpenDocument Text) format - from manual document creation through batch format conversion, mail merge, and Python/UNO/odfpy scripting.

When to use - and when NOT to

Use this skill when creating new documents in ODT format, converting between ODT/DOCX/PDF/HTML/RTF/TXT, automating document generation, batch processing documents, or building templates and standardized document formats. Related skills cover the rest of the LibreOffice suite: calc, impress, draw, base, docx-official, pdf-official, and workflow-automation.

Inputs and outputs

Five core capability areas: document creation (new ODT files, template-based generation, mail merge documents, fillable forms); format conversion (ODT to/from DOCX, DOC, RTF, HTML, TXT, EPUB, PDF/A); document automation (template generation, mail merge against CSV/spreadsheet/database sources, batch processing, automated reports); content manipulation (text extraction/insertion, style management, table creation, header/footer management); and integration via soffice CLI or Python/UNO scripting.

Three document-creation methods are shown: command line (soffice --writer template.odt); Python with UNO, resolving a socket connection and inserting text into a TextDocument via a text cursor before storing to a file URL; and odfpy, building a document object model directly (OpenDocumentText(), appending H/P elements) without needing a running LibreOffice instance.

Format conversion runs through soffice --headless --convert-to <format> <file>, with a batch-conversion loop pattern iterating over all .odt files in a directory. Template-based generation unzips an ODT template (ODT files are zip archives), performs ${key} placeholder substitution directly in the extracted content.xml, then re-zips the result - a lightweight generation path that avoids a full UNO session.

Supported input formats: ODT (native), DOCX, DOC, RTF, HTML, TXT, EPUB. Supported output formats: ODT, DOCX, PDF, PDF/A, HTML, RTF, TXT, EPUB. Supporting Python libraries: odfpy and ezodf.

Ten best practices: use styles for consistency, build templates for recurring documents, ensure accessibility (heading hierarchy, alt text), fill in document metadata, keep ODT source files in version control, test conversions thoroughly, embed fonts for PDF distribution, handle conversion failures gracefully, log automation operations, and clean up temporary files.

Troubleshooting covers a "cannot open socket" fix (kill stray soffice.bin, restart with an explicit --accept listener) and a conversion-quality fix using the pdf:writer_pdf_Export filter explicitly.

Integrations

Built on LibreOffice's soffice CLI and the UNO scripting API, with Python support via odfpy and ezodf, and cross-format interoperability with Microsoft Word's DOCX/DOC and PDF/HTML/RTF/EPUB outputs.

Who it's for

Developers and content teams who need to generate, convert, mail-merge, or batch-process ODT documents programmatically - via command-line automation, Python/UNO scripting, or direct odfpy document construction - rather than manually operating LibreOffice Writer's GUI.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.