Introduction¶
In DSH’s plugin ecosystem, processing office documents (docx, xlsx, pptx, etc.) and performing OCR on scanned documents are common requirements. Older solutions often rely on third-party libraries, which can lead to process crashes or introduce risks. dsh-wen is an Office suite plugin with zero third-party dependencies (using only Node.js built-in modules). It adds four global tools to DSH, supporting reading, writing, editing, and converting multiple formats, and includes self-healing for garbled Chinese PDFs and offline OCR capabilities. Its core design goal is “install it without breaking DSH.”
Core Features¶
The plugin registers four global tools, retaining the original tool names office_read / office_create / office_edit / office_convert. After installation, these tools can be invoked directly in all new sessions across all profiles without manual activation or path configuration.
- office_read: Read office documents and output them as Markdown, plain text, JSON, or metadata. Supports specifying worksheets, page ranges, batch inventory, and more.
- office_create: Create files by file extension, with content sources such as Markdown, tables, workbooks, and more.
- office_edit: Modify existing files in place at the zip/XML level, supporting text replacement, image insertion, and adding/removing worksheets or slides.
- office_convert: Read the source and write the target based on a unified content model, enabling cross-format conversion.
Supported formats include docx, xlsx, pptx, pdf, odf, csv, html, and legacy OLE2 formats (such as .doc/.xls/.ppt).
Installation and Activation¶
Install it using DSH’s package manager:
dsh plugin --profile web add github:17897693/dsh-wen
After installation, the plugin is mounted at ${DSH_HOME}/plugins/dsh-wen/ and automatically takes effect via cordis.patch.yml. To verify that the configuration is active, run:
dsh --profile web --dump-config
Typical Usage¶
Reading Documents¶
Read a Word document and convert it to Markdown:
office_read path="D:\报告.docx"
Read a specific worksheet in an Excel workbook:
office_read path="D:\台账.xlsx" sheet="明细"
Read the first 5 pages of a PDF:
office_read path="D:\讲义.pdf" pages="1-5"
Creating Files¶
Create a new Word document:
office_create path="D:\汇总.docx" markdown="# 标题\n- 要点\n\n| A | B |\n| --- | --- |\n| 1 | 2 |"
Editing and Conversion¶
Replace text in a document in place:
office_edit path="D:\报告.docx" operations=[{op:"replace_text",find:"旧",replace:"新"}]
Convert Excel to CSV:
office_convert source="D:\台账.xlsx" target="D:\台账.csv"
Scanned Document OCR¶
Perform automatic OCR on a scanned PDF:
office_read path="D:\扫描件.pdf"
Platform and Capability Notes¶
- Windows x64: Provides full capabilities, including the embedded RapidOCR engine (for offline OCR on scanned documents) and WinRT-based high-quality PDF rendering.
- Other platforms: OCR and high-quality PDF rendering automatically fall back to pure JavaScript capabilities, while basic reading, writing, and conversion are still supported.
Notes¶
- The plugin uses only Node.js built-in modules and introduces no third-party dependencies, aiming to ensure that it does not crash the DSH process after installation.
- Detailed technical documentation and changelogs are available in the repository’s SKILL.md, CHANGELOG.md, and DEVELOPMENT.md files.
Summary¶
dsh-wen provides a stable, dependency-free solution for Office document processing. For scenarios requiring handling of garbled PDFs or OCR for scanned documents, it offers a localized and offline solution. See its GitHub repository for complete parameter descriptions and known limitations.