Cli Anything Libreoffice

作者 hkuds34f519533bc1无许可证51K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库2周前更新

Command-line interface for Libreoffice - A stateful command-line interface for document editing, producing real ODF files (ZIP archives with ...

仅含说明Documents & Office
AI 生成的概览

用于创建和编辑 LibreOffice Writer、Calc 和 Impress 文档并生成 ODF 文件的有状态命令行界面。

功能
该技能介绍一个命令行工具,无需图形界面即可创建和操作 Writer、Calc 和 Impress 文档,生成真正的 ODF 文件(含 XML 的 ZIP 压缩包)。它提供文档、Writer 文本、Calc 工作表与单元格、Impress 幻灯片、样式、导出预设以及会话撤销/重做等命令组,并支持人类可读或 JSON 输出。项目以 JSON 形式保存,现有的 Office/ODF 文件可导入为该工程格式并随后导出。
适用场景
当智能体或高级用户需要从命令行生成或修改办公文档时使用,例如添加段落、标题、表格、工作表、单元格或幻灯片。它也适用于将现有 DOCX、XLSX、PPTX 或 ODF 文件导入为可编辑 JSON 再渲染为最终格式的工作流程。
运行要求
需要 Python 3.10+ 以及系统上安装的 LibreOffice;该包通过 pip 以 cli-anything-libreoffice 安装。它不附带脚本,仅包含说明。

cli-anything-libreoffice

A stateful command-line interface for document editing, producing real ODF files (ZIP archives with XML). Designed for AI agents and power users who need to create and manipulate Writer, Calc, and Impress documents without a GUI or LibreOffice installation.

Installation

This CLI is installed as part of the cli-anything-libreoffice package:

bash
pip install cli-anything-libreoffice

Prerequisites:

  • Python 3.10+
  • libreoffice must be installed on your system

Usage

Basic Commands

bash
# Show helpcli-anything-libreoffice --help
# Start interactive REPL modecli-anything-libreoffice
# Create a new projectcli-anything-libreoffice project new -o project.json
# Run with JSON output (for agent consumption)cli-anything-libreoffice --json project info -p project.json

REPL Mode

When invoked without a subcommand, the CLI enters an interactive REPL session:

bash
cli-anything-libreoffice# Enter commands interactively with tab-completion and history

Command Groups

Document

Document management commands.

CommandDescription
newCreate a new document
openOpen project JSON, or import an existing Office/ODF file
importImport an existing Office/ODF file to project JSON
import-formatsList supported import formats
saveSave the current document
infoShow document information
profilesList available page profiles
jsonPrint raw project JSON

Writer

Writer (word processor) commands.

CommandDescription
add-paragraphAdd a paragraph to the document
add-headingAdd a heading to the document
add-listAdd a list to the document
add-tableAdd a table to the document
add-page-breakAdd a page break
removeRemove a content item by index
listList all content items
set-textSet the text of a content item

Calc

Calc (spreadsheet) commands.

CommandDescription
add-sheetAdd a new sheet
remove-sheetRemove a sheet by index
rename-sheetRename a sheet
set-cellSet a cell value
get-cellGet a cell value
list-sheetsList all sheets

Impress

Impress (presentation) commands.

CommandDescription
add-slideAdd a slide to the presentation
remove-slideRemove a slide by index
set-contentUpdate a slide's title and/or content
list-slidesList all slides
add-elementAdd an element to a slide

Style Group

Style management commands.

CommandDescription
createCreate a new style
modifyModify an existing style
listList all styles
applyApply a style to a content item (Writer only)
removeRemove a style

Export Group

Export/render commands.

CommandDescription
presetsList export presets
preset-infoShow preset details
renderExport the document to a file

Session

Session management commands.

CommandDescription
statusShow session status
undoUndo the last operation
redoRedo the last undone operation
historyShow undo history

Examples

Create a New Project

Create a new libreoffice project file.

bash
cli-anything-libreoffice project new -o myproject.json# Or with JSON output for programmatic usecli-anything-libreoffice --json project new -o myproject.json

Interactive REPL Session

Start an interactive session with undo/redo support.

bash
cli-anything-libreoffice# Enter commands interactively# Use 'help' to see available commands# Use 'undo' and 'redo' for history navigation

Export Project

Export the project to a final output format.

bash
cli-anything-libreoffice --project myproject.json export render output.pdf --overwrite

State Management

The CLI maintains session state with:

  • Undo/Redo: Up to 50 levels of history
  • Project persistence: Save/load project state as JSON
  • Existing file import: Convert ODF/DOCX/XLSX/PPTX and related formats into editable project JSON
  • Session tracking: Track modifications and changes

Output Formats

All commands support dual output modes:

  • Human-readable (default): Tables, colors, formatted text
  • Machine-readable (--json flag): Structured JSON for agent consumption
bash
# Human outputcli-anything-libreoffice project info -p project.json
# JSON output for agentscli-anything-libreoffice --json project info -p project.json

For AI Agents

When using this CLI programmatically:

  1. Always use --json flag for parseable output
  2. Check return codes - 0 for success, non-zero for errors
  3. Parse stderr for error messages on failure
  4. Use absolute paths for all file operations
  5. Import existing Office files to JSON first with document import input.docx -o work.json
  6. Verify outputs exist after export operations

More Information

  • Full documentation: See README.md in the package
  • Test coverage: See TEST.md in the package
  • Methodology: See HARNESS.md in the cli-anything-plugin

Version

1.0.0

来源与署名

来源:hkuds/cli-anything位于skills/cli-anything-libreoffice提交34f5195

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架