DSH HUB
首页插件商店插件包社区排行榜资源发布指南
插件源码
返回插件目录

Anakonda124 /

Anakonda124/dsh-uno-office-win

已验证

LibreOffice (UNO) office engine for DSH - Windows-ready fork with full Writer formatting

★ 0 Stars0 Forks0 IssuesN/A 社区评分0 已确认安装
查看 GitHub
README来源: main@1d21a42c

dsh-uno-office-win

LibreOffice (UNO) office engine for DeepSeek Harness, ready for Windows, with full Writer formatting. Fork of dsh-uno-office (MIT), see Credits below.

The plugin is installed in the DSH profile, so it works in every workspace — the tools accept absolute paths and do not depend on the current working directory.

Tools

Tool Purpose
lo_status Show python, soffice, port, profile and connection state. Run this first.
lo_create Create docx/odt (Writer), xlsx/ods (Calc), pptx/odp (Impress).
lo_read Read paragraphs/styles plus tables and graphics; detail:true adds formatting.
lo_edit Replace text, append blocks, change page/header/footer/styles, format a paragraph, update TOC; Calc and Impress ops.
lo_convert Export to PDF or convert between formats.
lo_review_export / lo_review_import Human-in-the-loop editing round-trip.
lo_shutdown Stop the shared headless LibreOffice instance.

Writer spec (short version)

{
  "page": {"size": "A4", "orientation": "portrait",
            "margins_cm": {"top": 2, "bottom": 2, "left": 2.5, "right": 1.5},
            "header_cm": 1.0, "footer_cm": 1.0},
  "defaults": {"name": "Times New Roman", "size_pt": 12, "color": "#1F1F1F"},
  "styles": [{"name": "Body", "based_on": "Standard",
              "font": {"name": "Times New Roman", "size_pt": 12},
              "paragraph": {"align": "justify", "line_spacing": 1.15,
                            "first_line_indent_cm": 1.25, "space_after_pt": 6}}],
  "header": {"text": "Report", "align": "right", "page_number": true,
             "separator_line": true, "font": {"size_pt": 9, "italic": true}},
  "footer": {"text": "Page", "align": "center", "page_number": true},
  "blocks": [
    {"type": "title", "text": "Title"},
    {"type": "subtitle", "text": "Subtitle"},
    {"type": "heading", "level": 1, "text": "Section"},
    {"type": "paragraph", "style": "Body", "runs": [
        {"text": "plain "}, {"text": "bold red", "bold": true, "color": "#C00000"}]},
    {"type": "list", "ordered": false, "items": ["one", "two"]},
    {"type": "table", "header": true, "header_bg": "#DCE6F1",
     "rows": [["A", "B"], ["1", "2"]]},
    {"type": "image", "path": "C:\\\\abs\\\\picture.png", "width_cm": 10, "caption": "Fig. 1"},
    {"type": "rule"},
    {"type": "page_break"},
    {"type": "toc", "title": "Contents", "levels": 3}
  ]
}

Font keys: name, size_pt, bold, italic, underline (single/double), strikeout, color, highlight, uppercase, small_caps, superscript, subscript.

Paragraph keys: align, line_spacing, space_before_pt, space_after_pt, first_line_indent_cm, left_indent_cm, right_indent_cm, keep_with_next.

content.paragraphs (string, {text, style} or {text, heading}) is still accepted for compatibility.

Margins, header and footer

margins_cm.top/.bottom are the body margins in Word terms; header_cm/footer_cm are the distances from the page edge to the header/footer. LibreOffice stores the header inside its top margin, so the bridge pins a fixed header line height and recomputes HeaderBodyDistance to make the exported Word margins exact.

Requirements and runtime notes

  • LibreOffice (any recent version) with its bundled program\python.exe, which must be able to import uno. The bridge also looks at %ProgramFiles%, %ProgramFiles(x86)%, %LOCALAPPDATA%\Programs, and the Windows registry.
  • soffice runs headless on 127.0.0.1:2002 (override with DSH_UNO_PORT) using an isolated profile in %USERPROFILE%\.dsh\office-kit\uno-profile, so it does not clash with a LibreOffice window you have open.
  • The bridge speaks JSON in UTF-8 on both stdin and stdout, whatever the Windows ANSI code page is, so Cyrillic, Σ, Δ, ≤, → and friends survive the round-trip. PYTHONIOENCODING/PYTHONUTF8 are set for the child by the bundle.
  • If a document is open in another LibreOffice window (a .~lock.<name># file exists), lo_read/lo_edit/lo_convert retry it read-only instead of failing; if the load still fails you get a message naming the lock file.
  • DSH_UNO_PYTHON, DSH_UNO_SOFFICE, DSH_UNO_PROFILE override detection.
  • The first call after a restart starts LibreOffice (a few seconds); later calls reuse it.

Enabling and disabling

The plugin is a normal DSH bundle:

  • Plugins page → the dsh-uno-office-win row → toggle it off. The tools disappear from the agent and the bundled ctx.effect cleanup stops the headless soffice, so nothing keeps running in the background.
  • Toggle it back on (or reinstall with plugin_manager) to get the tools again.
  • The original dsh-uno-office bundle stays installed but disabled; the two do not share tool names (dsh-uno-office uses uno_*, this fork uses lo_*), so both can even be enabled at the same time.

Known limitations

  • widths_cm on tables is best-effort: headless LibreOffice normalises writer table column separators on export, so exported columns may end up equal.
  • No merged table cells, different headers per page parity, columns, footnotes, hyperlinks or SmartArt yet.
  • A TOC is exported as a Word field; Word may ask to update fields on open.
  • Round-tripping an existing Word document through LibreOffice can alter exotic features.
  • The header/footer line height is fixed to keep margins deterministic; keep header text to one line.

Credits

Derived from dsh-uno-office (MIT), which itself wraps LibreOffice UNO. This fork adds Windows discovery, an isolated profile, and the Writer formatting engine.

DSH HUB

社区维护的 DSH 插件索引。不是 GitHub 或 DeepSeek AI 的官方产品。

社区资源API关于
—/ 5

暂无评分

已验证 DSH bundle

Commit 1d21a42cf523

社区评论

还没有评论,来写第一条。