dsh-office-live: Reading and Writing Currently Open Word / Excel / PowerPoint via COM

Introduction

When performing Office-related tasks in DeepSeek Harness (DSH), the common approach is to read and write .docx, .xlsx, and .pptx files on the disk. If a user makes changes to a few paragraphs in Word but hasn’t saved them yet, the agent can only see the content from the last disk write. After modifying a file, the user often has to close and reopen it, or manually refresh it, to see the results in the window.

dsh-office-live takes a different approach: it hooks into running instances of Word, Excel, and PowerPoint via Windows COM to read, take screenshots of, and edit current foreground documents in place. This eliminates the need for repeated saving, closing, and reopening just to sync content. Maintained by BeiSheng2333, it is categorized as a client-side plugin in the SkillHub community directory. The repository is available on GitHub. The current version is 0.1.0, licensed under MIT.

What is this

The plugin registers a set of tools with DSH. On the Node side, seven tools are registered via @deepseek-ai/dsh-tools in lib/index.js, while the actual COM and screenshot operations are executed by assets/office-live.ps1. Results are transmitted via UTF-8 side files to avoid garbled Chinese text caused by Windows console code pages. Unlike the similar plugin dsh-office-tools (which is file-oriented), this plugin only operates on the active document currently visible to the user, including unsaved input.

Core Features

The capabilities described below correspond to the tools listed in the README. By default, edits do not write to disk unless save: true is explicitly passed during the call.

Status and Reading

Tool Function
office_live_status Check if Word / Excel / PowerPoint are running and which documents are open in each application
office_live_read Read live content as JSON: Word paragraphs and styles, Excel cells (including formula evaluation results), PowerPoint shapes
office_live_shot Capture a PNG screenshot of the application window (including the ribbon and page)
office_live_snapshot Performs read + shot in a single call; ideal for understanding the current state before editing

Reading limits (as specified in the README): Word captures up to the first 400 paragraphs; Excel covers the used range of the active sheet, up to 200 rows × 40 columns.

Editing and Window Management

Tool Function
office_live_edit Perform batch in-place editing (paragraphs, find & replace, tables, cells, slides, etc.)
office_live_open Open a file in the real Office application so it is visible on screen
office_live_close Close the window (with an option to save or not)

Operations supported by office_live_edit include:

  • Word: word.append_paragraph, word.insert_paragraph_before, word.set_paragraph, word.replace, word.insert_table, word.insert_page_break
  • Excel: excel.set_cell, excel.set_range, excel.add_sheet
  • PowerPoint: ppt.set_text, ppt.add_slide

Verifiable behaviors from the README demo (appearing in the window without saving) include: appending chapters and tables in Word; reading formula values and writing them to a “Remarks” column in Excel; modifying bullet points and using ppt.add_slide to add a second page in PowerPoint. Screenshots and descriptions are available in the repository’s docs/images/.

Environment and Dependencies

  1. Windows with a desktop installation of Microsoft Office. COM ProgIDs must be Word.Application, Excel.Application, and PowerPoint.Application. The README notes testing on Office LTSC 2024.
  2. Windows PowerShell 5.1+ (powershell.exe); the environment variable OFFICE_LIVE_POWERSHELL can be used to specify a different interpreter (e.g., pwsh.exe).
  3. Real Office only: Microsoft Store placeholder packages and the web version do not support COM. WPS uses different ProgIDs and is outside the scope of this plugin’s design.
  4. Node ≥ 20; DSH compatibility is listed in the dsh.compatibility field in package.json.

Installation and Activation

Add dsh-office-live via the plugin marketplace UI, or install from a checkout / archive:

dsh plugin --profile desktop add ./dsh-office-live-0.1.0.tgz

Restart DSH after installation; the tools mentioned above will be available in new sessions. It is recommended to review the repository source code and the MIT license before installing. The plugin runs with the current DSH process permissions and will operate on local, already-open Office instances.

Typical Usage Workflow

  1. Have the user open the target document in Word / Excel / PowerPoint (or use office_live_open to open the file).
  2. Call office_live_snapshot (or office_live_read followed by office_live_shot) to provide the structure and window view to the agent.
  3. Use office_live_edit to modify content via a JSON operation list; the user can use Ctrl+Z in the window to undo changes. After confirming, decide whether to save with save: true.
  4. Call office_live_close when finishing up.

Screenshots will briefly bring the Office window to the front (stealing focus); this is documented behavior in the README.

Security and Boundaries

  • Attaches only to existing Office processes; does not create hidden document copies.
  • Does not save by default; suitable for a “preview before persisting” collaboration style.
  • Complements file-based Office plugins: choose “live” when dealing with unsaved edits or when immediate on-screen visibility is required. For pure batch processing or headless (no GUI) scenarios, dsh-office-tools or similar plugins for reading/writing files remain a good choice.

For more detailed architecture information (three layers, JSON bridge, UTF-8 side files, reasons for default no-save behavior), please refer to the repository documentation docs/HOW-IT-WORKS.md.

Conclusion

dsh-office-live connects the DSH agent to the Office window the user is currently viewing: reading live documents, capturing windows, and modifying via COM in place, reducing the cost of file round-trips and reopening. Community directory page: SkillHub — dsh-office-live; Source code and Issues: github.com/BeiSheng2333/dsh-office-live.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye