Tiangong Wps Word Automation

👤 jirboy 📦 v1.0.0 ⭐ 4.2 ⬇️ 1.2K 下載
📄 辦公效率 免費

📖 技能介紹


name: wps-word-automation description: 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 images). Use for single-document actions (no batch).


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"

7w4.net小蔥技能。

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"

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.

🤖 AI 評測

這是一個功能豐富、文件完善的文件自動化 Skill,支援 WPS 和 Word 雙平臺,涵蓋文本處理、格式設定、合併拆分、匯出等常用操作。程式碼邏輯清晰,易於理解和使用。不足之處是依賴說明略顯簡略,部分邊界情況處理不夠完善,整體質量良好,能夠滿足日常文件處理需求。

📊 多維度評分

適應性4.5
規範性4
有效性4.1
可靠性3.8
可信度5

📁 包含檔案 (4 個)

📄 SKILL.md 3 KB
📄 _meta.json 150 B
📄 package.json 172 B
📄 scripts/wps_word_automation.py 6.9 KB