From antigravity-awesome-skills
Creates, edits, converts (ODT/DOCX/PDF/HTML/RTF), and automates documents with LibreOffice Writer via CLI (soffice), Python UNO, and odfpy. For mail merge and batch workflows.
npx claudepluginhub sickn33/antigravity-awesome-skillsThis skill uses the workspace's default tool permissions.
LibreOffice Writer skill for creating, editing, converting, and automating document workflows using the native ODT (OpenDocument Text) format.
Creates, edits, converts (ODT/DOCX/PDF/HTML/RTF), and automates documents with LibreOffice Writer via CLI (soffice), Python UNO, and odfpy. For mail merge and batch workflows.
Creates, reads, edits .docx files using docx-js for generation, pandoc for extraction, Python scripts for tracked changes, images, XML editing.
Creates, reads, edits, and analyzes .docx files using docx-js for generation, pandoc/Python for extraction, XML editing, tracked changes, and LibreOffice conversions.
Share bugs, ideas, or general feedback.
LibreOffice Writer skill for creating, editing, converting, and automating document workflows using the native ODT (OpenDocument Text) format.
Use this skill when:
soffice --writer template.odt
import uno
def create_document():
local_ctx = uno.getComponentContext()
resolver = local_ctx.ServiceManager.createInstanceWithContext(
"com.sun.star.bridge.UnoUrlResolver", local_ctx
)
ctx = resolver.resolve(
"uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"
)
smgr = ctx.ServiceManager
doc = smgr.createInstanceWithContext("com.sun.star.text.TextDocument", ctx)
text = doc.Text
cursor = text.createTextCursor()
text.insertString(cursor, "Hello from LibreOffice Writer!", 0)
doc.storeToURL("file:///path/to/document.odt", ())
doc.close(True)
from odf.opendocument import OpenDocumentText
from odf.text import P, H
doc = OpenDocumentText()
h1 = H(outlinelevel='1', text='Document Title')
doc.text.appendChild(h1)
doc.save("document.odt")
# ODT to DOCX
soffice --headless --convert-to docx document.odt
# ODT to PDF
soffice --headless --convert-to pdf document.odt
# DOCX to ODT
soffice --headless --convert-to odt document.docx
# Batch convert
for file in *.odt; do
soffice --headless --convert-to pdf "$file"
done
import subprocess
import tempfile
from pathlib import Path
def generate_from_template(template_path, variables, output_path):
with tempfile.TemporaryDirectory() as tmpdir:
subprocess.run(['unzip', '-q', template_path, '-d', tmpdir])
content_file = Path(tmpdir) / 'content.xml'
content = content_file.read_text()
for key, value in variables.items():
content = content.replace(f'${{{key}}}', str(value))
content_file.write_text(content)
subprocess.run(['zip', '-rq', output_path, '.'], cwd=tmpdir)
return output_path
soffice --headless
soffice --headless --convert-to <format> <file>
soffice --writer # Writer
soffice --calc # Calc
soffice --impress # Impress
soffice --draw # Draw
pip install odfpy # ODF manipulation
pip install ezodf # Easier ODF handling
killall soffice.bin
soffice --headless --accept="socket,host=localhost,port=8100;urp;"
soffice --headless --convert-to pdf:writer_pdf_Export document.odt