← 返回
未分类

word-auto-format

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.
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.
user_e41a5bf9
未分类 community v1.0.0 1 版本 99130.4 Key: 无需
★ 0
Stars
📥 114
下载
💾 0
安装
1
版本
#latest

概述

Word 自动排版 Skill

概述

本 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. 如有需要可调整方案重跑

自定义排版需求处理

若用户有特殊要求(如特定字体、特定行距、特定颜色),直接修改 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 — 完整参数说明与自定义方案指南

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-05-17 20:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,217 📥 266,660
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,362 📥 318,706
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 670 📥 324,317