dfk1352/LibreOffice-skills / skills/libreoffice-writer
libreoffice-writer
VerifiedUse when creating, editing, formatting, exporting, or extracting LibreOffice Writer (.odt) documents via UNO, including session-based edits, structured text targets, tables, images, lists, patch workflows, and snapshots.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.3 KB |
| references/troubleshooting.md | markdown | 3.9 KB |
| scripts/colors.py | script | 4.6 KB |
| scripts/constants.py | script | 180 B |
| scripts/exceptions.py | script | 748 B |
| scripts/patch_base.py | script | 12.1 KB |
| scripts/session.py | script | 2.6 KB |
| scripts/uno_bridge.py | script | 9.1 KB |
| scripts/writer/__init__.py | script | 554 B |
| scripts/writer/core.py | script | 3.4 KB |
| scripts/writer/exceptions.py | script | 2.5 KB |
| scripts/writer/patch.py | script | 9.4 KB |
| scripts/writer/session.py | script | 18.8 KB |
| scripts/writer/snapshot.py | script | 5.6 KB |
| scripts/writer/targets.py | script | 14.7 KB |
references/troubleshooting.md
View on GitHub# Troubleshooting
## "Binary URP bridge disposed during call" with LibreOffice 26.x
Symptom examples:
- `RuntimeException: Binary URP bridge disposed during call`
- `loadComponentFromURL` succeeds but returns a broken proxy
Cause:
- LibreOffice 26.x installs to `/opt/libreoffice26.x/` with a versioned
binary (e.g. `libreoffice26.2`) instead of the usual `soffice` in PATH.
System Python does not inherit the `URE_BOOTSTRAP` and `UNO_PATH` environment
variables that LO's bundled Python sets automatically. Without them,
`uno.getComponentContext()` creates a minimal context that cannot bridge to
a running LO instance.
What to check:
1. Ensure you are using the latest version of this skill (the UNO bridge now
detects versioned binaries and sets the required variables automatically).
2. If using a custom `PYTHONPATH` setup, verify that the `uno_bridge.py` from
this skill's `scripts/` directory is the one being imported.
3. As a manual workaround, set the variables before running your script:
```bash
export URE_BOOTSTRAP="vnd.sun.star.pathname:/opt/libreoffice26.2/program/fundamentalrc"
export UNO_PATH="/opt/libreoffice26.2/program"
```
## UNO import fails after setting `PYTHONPATH`
Symptom examples:
- `ModuleNotFoundError: No module named 'uno'`
- Writer imports work, but opening a document fails before LibreOffice starts
Cause:
- `PYTHONPATH=<skill_base_dir>/scripts` exposes the bundled skill modules, but
some environments still need the system LibreOffice Python packages on the
Python import path.
What to check:
1. LibreOffice is installed on the machine.
2. The Python process can import `uno`.
3. If `uno` is missing, add the distro LibreOffice Python path before running
your script. A common Linux path is `/usr/lib/python3/dist-packages`.
Example:
```bash
PYTHONPATH="skills/libreoffice-writer/scripts:/usr/lib/python3/dist-packages" python3 your_script.py
```
If your platform uses a different LibreOffice Python location, use that path
instead.
## Patch result says `document_persisted = false`
Meaning:
- `document_persisted` reports whether the patch mutations currently exist in a
saved document state.
- Standalone `writer.patch(...)` saves the file when successful mutations should
persist.
- `session.patch(...)` reports `true` when the session now holds successful
in-memory mutations, even before the session is later closed and stored.
## Target matching feels brittle
Recommendations:
1. Anchor text targets with full sentences or paragraph-sized phrases, not
single words.
2. Add `after` and `before` when the same wording may appear elsewhere.
3. Use `occurrence` only when repeated matches are intentional and stable.
## Version Compatibility
Some Writer skill features depend on LibreOffice 26.2 or newer. The core
editing API (create, session, export, patch, snapshots) works on older versions.
### Markdown import / export (26.2+)
`create_document(path, source="doc.md")` and `export_document(path, out, "md")`
rely on the `Markdown` filter, which was added in LibreOffice 26.2. On older
versions, these calls will fail with a UNO filter error because the filter name
is not registered.
Workaround: convert Markdown to ODT or HTML externally before importing, and
export to HTML instead of Markdown on older versions.
### `"start"` / `"end"` paragraph alignment (26.2+)
`TextFormatting(align="start")` and `TextFormatting(align="end")` set the UNO
`ParaAdjust` property to `ParagraphAdjust.START` (5) and
`ParagraphAdjust.END` (6), enum values added in LibreOffice 26.2. These
alignments are direction-aware: `start` resolves to left in LTR paragraphs and
right in RTL paragraphs (and vice versa for `end`). This is useful for styles
shared across languages with different writing directions.
On older versions, setting these values will either be silently ignored or raise
a UNO property error. Use `"left"` / `"right"` instead when targeting
pre-26.2 installations.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |