Word Automation
Automate common Word/WPS document operations on Windows via COM (read text, replace, insert, headings, headers/footers, page breaks, merge, split, export to PDF/TXT, add/replace im…
Fadeloo
@fadeloo
What This Skill Does
Automates single-document operations in Microsoft Word or WPS Writer on Windows via COM. Supports reading text, find/replace, inserting text, applying headings, setting headers/footers, inserting page breaks, merging multiple documents, splitting by page ranges, exporting to PDF/TXT, and adding or replacing images.
Replaces manual editing and repetitive formatting tasks in Word or WPS by exposing common document operations through a single command-line tool.
When to Use It
- Extract plain text from a Word or WPS document for analysis or archiving
- Replace specific text strings across a single document
- Insert a header or footer into an existing document
- Merge several .docx files into one combined document
- Export a document to PDF for distribution or printing
- Split a large document into smaller files by page ranges
Install
$ openclaw skills install @fadeloo/tiangong-wps-word-automationWPS/Word Automation (Windows)
Use the bundled Python script to control Word or WPS via COM.
Requirements
- Windows with Microsoft Word or WPS Writer installed.
- Python + pywin32 (
python -m pip install pywin32).
Quick start
python {baseDir}/scripts/wps_word_automation.py read --input "C:\path\file.docx"
python {baseDir}/scripts/wps_word_automation.py replace --input "C:\path\file.docx" --find "旧" --replace "新" --save "C:\path\out.docx"
python {baseDir}/scripts/wps_word_automation.py export --input "C:\path\file.docx" --format pdf --output "C:\path\out.pdf"
Commands
read
Extract plain text.
python {baseDir}/scripts/wps_word_automation.py read --input "C:\path\file.docx" --output "C:\path\out.txt"
replace
Find/replace text.
python {baseDir}/scripts/wps_word_automation.py replace --input "C:\path\file.docx" --find "old" --replace "new" --save "C:\path\out.docx"
insert
Insert text at start/end.
python {baseDir}/scripts/wps_word_automation.py insert --input "C:\path\file.docx" --text "Hello" --where start --save "C:\path\out.docx"
headings
Apply Heading 1/2/3 to matching lines.
python {baseDir}/scripts/wps_word_automation.py headings --input "C:\path\file.docx" --level 1 --prefix "# " --save "C:\path\out.docx"
header-footer
Set header/footer text.
python {baseDir}/scripts/wps_word_automation.py header-footer --input "C:\path\file.docx" --header "标题" --footer "页脚" --save "C:\path\out.docx"
page-break
Insert a page break at the end.
python {baseDir}/scripts/wps_word_automation.py page-break --input "C:\path\file.docx" --save "C:\path\out.docx"
merge
Merge multiple docs into one.
python {baseDir}/scripts/wps_word_automation.py merge --inputs "a.docx" "b.docx" --output "merged.docx"
split
Split by page ranges (e.g., "1-3,4-6").
python {baseDir}/scripts/wps_word_automation.py split --input "C:\path\file.docx" --pages "1-3,4-6" --outdir "C:\out"
export
Export to PDF or TXT.
python {baseDir}/scripts/wps_word_automation.py export --input "C:\path\file.docx" --format pdf --output "C:\path\out.pdf"
python {baseDir}/scripts/wps_word_automation.py export --input "C:\path\file.docx" --format txt --output "C:\path\out.txt"
image
Add or replace image at the end.
python {baseDir}/scripts/wps_word_automation.py image --input "C:\path\file.docx" --image "C:\path\img.png" --save "C:\path\out.docx"
Notes
- If WPS is installed, try
--app wps; otherwise default uses Word. - Use
--visible trueif you need to watch the UI. - Avoid batch usage; this skill is for single-document operations.
Related skills
PowerPoint Automation
@fadelooAutomate common PowerPoint/WPS Presentation operations on Windows via COM (read text/notes/outline, export PDF/images, replace text, insert/delete slides, unify font/size/theme, extract images/media). Use for single-presentation actions (no batch).
Document Pro
@jackeven02文档处理技能 - 让 AI 能够读取、解析、提取 PDF、DOCX、PPT 等文档的关键信息。当用户要求分析文档、提取内容、总结报告时触发此技能。
Skywork Document
@gxcun17Skywork Document (skywork) - Use for ANY task producing a document output. Generates professional documents in docx, pdf, markdown, and html. Capabilities: (...
mineru document extractor
@mineru-extractMinerU document extraction — convert PDFs, scanned documents, images, Word (DOC/DOCX), PowerPoint (PPT/PPTX), Excel (XLS/XLSX), and web pages into clean Mark...
Zotero
@terwoxManage Zotero reference libraries via the Web API. Search, list, add items by DOI/ISBN/PMID (with duplicate detection), delete/trash items, update metadata and tags, export in BibTeX/RIS/CSL-JSON, batch-add from files, check PDF attachments, cross-reference citations, find missing DOIs via CrossRef, and fetch open-access PDFs. Supports --json output for scripting. Use when the user asks about academic references, citation management, literature libraries, PDFs for papers, bibliography export, or Zotero specifically.
Pdf Document Generation Cellcog
@nitishgargiitdAI PDF document generation powered by CellCog — PDF and DOCX output. Resumes, contracts, reports, proposals, invoices, certificates, NDAs, letters, brochures...