author:jm-jsjkxyjs01-wsj-402 name: word-auto-format description: > This skill should be used when the user wants to automatically format, typeset, or beautify a Word (.docx) document. Triggers include: "幫我排版這個Word", "自動格式化文件", "統一字型行距", "論文/報告排版", "Word排版", "整理文件格式", "format this Word file", "auto typeset", "standardize document style". The skill provides a Python script (word_formatter.py) that handles font unification, heading detection, line spacing, page margins, table formatting, and caption centering in one command. agent_created: true
本 skill 提供一鍵 Word 文件自動排版能力,基於 python-docx 實現,支援三種內建排版方案(通用/學術/商務),核心指令碼為 scripts/word_formatter.py。
| 功能 | 說明 |
|---|---|
| 頁面邊距 | 統一設定上下左右邊距 |
| 正文字型 | 中文字型(東亞字型)+ 英文字型分別設定 |
| 正文行距 | 固定行距(1.5倍行距) |
| 首行縮排 | 學術/通用方案自動縮排 2 字元 |
| 標題識別 | 自動識別"第一章""一、""1.1"等常見格式 |
| 標題樣式 | 黑體/微軟雅黑,多級顏色與間距 |
| 圖表標題 | 自動居中"圖1、表1、Figure 1"格式 |
| 表格樣式 | 單元格垂直居中,字號略小 |
| 原文備份 | 操作前自動生成 _backup.docx |
檢查使用者環境是否已安裝 python-docx:
python -c "import docx; print('OK')"
若未安裝,執行:
pip install python-docx
根據使用者需求選擇方案:
academic — 學術論文、畢業設計、學術報告(宋體/Times New Roman,黑體標題居中,嚴格行距)business — 商務報告、策劃方案、PPT 稿(微軟雅黑/Calibri,藍色標題,無首行縮排)default — 通用文件(介於兩者之間)若使用者未指定,詢問文件用途後再選擇,或直接使用 default。
指令碼路徑:scripts/word_formatter.py(位於本 skill 目錄)
python "<skill_dir>/scripts/word_formatter.py" "<input.docx>" ["<output.docx>"] --profile <profile>
示例:
# 學術論文
python word_formatter.py 論文.docx 論文_排版.docx --profile academic
# 商務報告(輸出檔案自動命名為 報告_formatted.docx)
python word_formatter.py 報告.docx --profile business
# 通用(自動輸出 文件_formatted.docx)
python word_formatter.py 文件.docx
指令碼執行完畢後,輸出包含以下統計資訊:
排版統計:
一級標題:X 處
二級標題:X 處
三級標題:X 處
正文段落:X 段
圖表標題:X 處
表格: X 個
告知使用者: 1. 輸出檔案路徑 2. 原文備份位置 3. 如有需要可調整方案重跑
更多技能請訪問小蔥技能站7w4.net。
若使用者有特殊要求(如特定字型、特定行距、特定顏色),直接修改 word_formatter.py 中的 PROFILES 字典對應方案,或新增自定義方案後使用 --profile 呼叫。
詳細引數參考:references/formatting_guide.md
.docx,不支援舊版 .doc 格式(如遇到 .doc,提示使用者先在 Word 中另存為 .docx)python-docx 0.8.x,建議使用該版本scripts/word_formatter.py — 核心排版指令碼,可直接執行references/formatting_guide.md — 完整引數說明與自定義方案指南這是一款實用的 Word 排版工具,能快速統一文件格式,對論文、報告排版很有幫助。預設了三種場景方案,基本能滿足日常需求,文件說明也很清晰。不過它只支援新版 docx 格式,對複雜排版(如文本框)支援有限。總體來說質量不錯,是值得一試的排版輔助工具。