← 返回
未分类 中文

Tiangong Wps 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...
在 Windows 上通过 COM 自动执行常见的 Word/WPS 文档操作(读取文本、替换、插入、标题、页眉/页脚、分页、合并、拆分、导出到…)
jirboy
未分类 clawhub v1.0.0 1 版本 99865.4 Key: 无需
★ 0
Stars
📥 742
下载
💾 0
安装
1
版本
#latest

概述

WPS/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 true if you need to watch the UI.
  • Avoid batch usage; this skill is for single-document operations.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 07:22 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Scientific Drawing

jirboy
科研绘图工具 - 支持技术路线图、流程图、原理图、架构图等科研图形绘制。基于 Python matplotlib/pillow,支持 SVG/PNG 高清输出。
★ 2 📥 701

Paper Reviewer

jirboy
论文审稿专家 - 对中英文论文进行学术评审,评估研究意义、创新性、研究价值、写作水平等,生成详细审稿意见和修改建议。
★ 1 📥 500

Semantic Scholar Search

jirboy
通过 Semantic Scholar API 免费检索学术论文,支持多领域搜索、元数据及高级筛选,兼容旧入口调用。
★ 0 📥 528