LibreOffice Writer
Overview
LibreOffice Writer skill for creating, editing, converting, and automating document workflows using the native ODT (OpenDocument Text) format.
When to Use This Skill
Use this skill when:
- Creating new documents in ODT format
- Converting documents between formats (ODT <-> DOCX, PDF, HTML, RTF, TXT)
- Automating document generation workflows
- Performing batch document operations
- Creating templates and standardized document formats
Core Capabilities
1. Document Creation
- Create new ODT documents from scratch
- Generate documents from templates
- Create mail merge documents
- Build forms with fillable fields
2. Format Conversion
- ODT to other formats: DOCX, PDF, HTML, RTF, TXT, EPUB
- Other formats to ODT: DOCX, DOC, RTF, HTML, TXT
- Batch conversion of multiple documents
3. Document Automation
- Template-based document generation
- Mail merge with data sources (CSV, spreadsheet, database)
- Batch document processing
- Automated report generation
4. Content Manipulation
- Text extraction and insertion
- Style management and application
- Table creation and manipulation
- Header/footer management
5. Integration
- Command-line automation via soffice
- Python scripting with UNO
- Integration with workflow automation tools
Workflows
Creating a New Document
Method 1: Command-Line
soffice --writer template.odt
Method 2: Python with UNO
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)
Method 3: Using odfpy
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")
Converting Documents
# 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
Template-Based Generation
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
Format Conversion Reference
Supported Input Formats
- ODT (native), DOCX, DOC, RTF, HTML, TXT, EPUB
Supported Output Formats
- ODT, DOCX, PDF, PDF/A, HTML, RTF, TXT, EPUB
Command-Line Reference
soffice --headless
soffice --headless --convert-to <format> <file>
soffice --writer # Writer
soffice --calc # Calc
soffice --impress # Impress
soffice --draw # Draw
Python Libraries
pip install odfpy # ODF manipulation
pip install ezodf # Easier ODF handling
Best Practices
- Use styles for consistency
- Create templates for recurring documents
- Ensure accessibility (heading hierarchy, alt text)
- Fill document metadata
- Store ODT source files in version control
- Test conversions thoroughly
- Embed fonts for PDF distribution
- Handle conversion failures gracefully
- Log automation operations
- Clean temporary files
Troubleshooting
Cannot open socket
killall soffice.bin
soffice --headless --accept="socket,host=localhost,port=8100;urp;"
Conversion Quality Issues
soffice --headless --convert-to pdf:writer_pdf_Export document.odt
Resources
Related Skills
- calc
- impress
- draw
- base
- docx-official
- pdf-official
- workflow-automation
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Source: sickn33/agentic-awesome-skills → skills/libreoffice/writer/SKILL.md
Also appears in: sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/libreoffice/writer/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/libreoffice/writer/SKILL.md
1---2name: writer3description: Document creation, format conversion (ODT/DOCX/PDF), mail merge, and automation with LibreOffice Writer.4---567# LibreOffice Writer89## Overview1011LibreOffice Writer skill for creating, editing, converting, and automating document workflows using the native ODT (OpenDocument Text) format.1213## When to Use This Skill1415Use this skill when:16- Creating new documents in ODT format17- Converting documents between formats (ODT <-> DOCX, PDF, HTML, RTF, TXT)18- Automating document generation workflows19- Performing batch document operations20- Creating templates and standardized document formats2122## Core Capabilities2324### 1. Document Creation25- Create new ODT documents from scratch26- Generate documents from templates27- Create mail merge documents28- Build forms with fillable fields2930### 2. Format Conversion31- ODT to other formats: DOCX, PDF, HTML, RTF, TXT, EPUB32- Other formats to ODT: DOCX, DOC, RTF, HTML, TXT33- Batch conversion of multiple documents3435### 3. Document Automation36- Template-based document generation37- Mail merge with data sources (CSV, spreadsheet, database)38- Batch document processing39- Automated report generation4041### 4. Content Manipulation42- Text extraction and insertion43- Style management and application44- Table creation and manipulation45- Header/footer management4647### 5. Integration48- Command-line automation via soffice49- Python scripting with UNO50- Integration with workflow automation tools5152## Workflows5354### Creating a New Document5556#### Method 1: Command-Line57```bash58soffice --writer template.odt59```6061#### Method 2: Python with UNO62```python63import uno6465def create_document():66 local_ctx = uno.getComponentContext()67 resolver = local_ctx.ServiceManager.createInstanceWithContext(68 "com.sun.star.bridge.UnoUrlResolver", local_ctx69 )70 ctx = resolver.resolve(71 "uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext"72 )73 smgr = ctx.ServiceManager74 doc = smgr.createInstanceWithContext("com.sun.star.text.TextDocument", ctx)75 text = doc.Text76 cursor = text.createTextCursor()77 text.insertString(cursor, "Hello from LibreOffice Writer!", 0)78 doc.storeToURL("file:///path/to/document.odt", ())79 doc.close(True)80```8182#### Method 3: Using odfpy83```python84from odf.opendocument import OpenDocumentText85from odf.text import P, H8687doc = OpenDocumentText()88h1 = H(outlinelevel='1', text='Document Title')89doc.text.appendChild(h1)90doc.save("document.odt")91```9293### Converting Documents9495```bash96# ODT to DOCX97soffice --headless --convert-to docx document.odt9899# ODT to PDF100soffice --headless --convert-to pdf document.odt101102# DOCX to ODT103soffice --headless --convert-to odt document.docx104105# Batch convert106for file in *.odt; do107 soffice --headless --convert-to pdf "$file"108done109```110111### Template-Based Generation112```python113import subprocess114import tempfile115from pathlib import Path116117def generate_from_template(template_path, variables, output_path):118 with tempfile.TemporaryDirectory() as tmpdir:119 subprocess.run(['unzip', '-q', template_path, '-d', tmpdir])120 content_file = Path(tmpdir) / 'content.xml'121 content = content_file.read_text()122 for key, value in variables.items():123 content = content.replace(f'${{{key}}}', str(value))124 content_file.write_text(content)125 subprocess.run(['zip', '-rq', output_path, '.'], cwd=tmpdir)126 return output_path127```128129## Format Conversion Reference130131### Supported Input Formats132- ODT (native), DOCX, DOC, RTF, HTML, TXT, EPUB133134### Supported Output Formats135- ODT, DOCX, PDF, PDF/A, HTML, RTF, TXT, EPUB136137## Command-Line Reference138139```bash140soffice --headless141soffice --headless --convert-to <format> <file>142soffice --writer # Writer143soffice --calc # Calc144soffice --impress # Impress145soffice --draw # Draw146```147148## Python Libraries149150```bash151pip install odfpy # ODF manipulation152pip install ezodf # Easier ODF handling153```154155## Best Practices1561571. Use styles for consistency1582. Create templates for recurring documents1593. Ensure accessibility (heading hierarchy, alt text)1604. Fill document metadata1615. Store ODT source files in version control1626. Test conversions thoroughly1637. Embed fonts for PDF distribution1648. Handle conversion failures gracefully1659. Log automation operations16610. Clean temporary files167168## Troubleshooting169170### Cannot open socket171```bash172killall soffice.bin173soffice --headless --accept="socket,host=localhost,port=8100;urp;"174```175176### Conversion Quality Issues177```bash178soffice --headless --convert-to pdf:writer_pdf_Export document.odt179```180181## Resources182183- [LibreOffice Writer Guide](https://documentation.libreoffice.org/)184- [LibreOffice SDK](https://wiki.documentfoundation.org/Documentation/DevGuide)185- [UNO API Reference](https://api.libreoffice.org/)186- [odfpy](https://pypi.org/project/odfpy/)187188## Related Skills189190- calc191- impress192- draw193- base194- docx-official195- pdf-official196- workflow-automation197198## Limitations199- Use this skill only when the task clearly matches the scope described above.200- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.201- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.202203---204205**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/libreoffice/writer/SKILL.md`206207**Also appears in:** `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/libreoffice/writer/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/libreoffice/writer/SKILL.md`