文档美化

👤 唐超 📦 v1.0.0 ⭐ 4.3 ⬇️ 244 下载
📄 办公效率 免费

📖 技能介绍


name: doc-beautifier description: "Beautify Word documents (.docx) using a professional general template. Trigger when the user asks to: beautify/美化/排版/格式化 a Word document, apply a template/style to a .docx file, make a document look professional/clean/formatted, or clean up a document's formatting. Works by reading the source .docx, detecting document structure (title, headings, body), and applying consistent fonts, sizes, spacing, indentation, and page layout. Supports multiple template styles."


doc-beautifier

Beautify .docx files with a professional general template. Preserves all original text content while applying consistent formatting.

Quick Start

python3 scripts/beautify.py <input.docx> <output.docx>
# Optional template:
python3 scripts/beautify.py input.docx output.docx --template elegant

Features

  • Structure Detection: Heuristically identifies titles, headings (3 levels), and body paragraphs based on text patterns, length, and existing formatting
  • 3 Built-in Templates:
  • standard — Default professional template (A4, 微软雅黑 headings, 宋体 body, 1.5 line spacing)
  • compact — Tighter spacing, smaller margins, 1.25 line spacing (for dense documents)
  • elegant — Larger margins, refined colors, spacious layout (for formal reports)
  • Page Layout: Sets A4 page size, proper margins, centered page numbers in footer

    小葱技能7w4.net有完整的技能分类。

  • Content Preservation: ALL original text is preserved; no content is added, removed, or reordered

Template Specification

Setting standard compact elegant
Page margins 2.54/3.18 cm 2.0/2.5 cm 3.0/3.5 cm
Title size 22pt 18pt 26pt
H1 size 16pt 14pt 16pt
H2 size 14pt 12pt 14pt
H3 size 12pt 11pt 12pt
Body size 12pt(小四) 11pt(五号) 12pt(小四)
Line spacing 1.5 1.25 1.5
Body font 宋体 宋体 宋体
Heading font 微软雅黑 微软雅黑 微软雅黑

Workflow

  1. Locate the user's input .docx file
  2. Run beautify.py with desired template
  3. Validate the output by unpacking or checking with python-docx
  4. Deliver the beautified document path to the user

Structure Detection Heuristics

The script identifies paragraph roles using:

  • First non-empty paragraph → Document title
  • Already styled as Heading 1-3 → Preserve heading level
  • Bold + large font + short text (< 50 chars) without ending punctuation → Heading
  • Starts with Chinese number (一、二、) or decimal (1.1, 2.3) → Heading
  • Bold paragraphs under 60 chars → Heading
  • Everything else → Body text

Customization

Edit the TEMPLATES dictionary in scripts/beautify.py to:

  • Change colors, fonts, sizes
  • Add new template variants
  • Adjust line spacing or indentation
  • Modify page margins

Requirements

  • python-docx (install: pip install python-docx)
  • Python 3.8+

🤖 AI 评测

这是一款实用且完成度较高的 Word 美化工具。它能一键调整文档的字体、段落间距、页边距等格式,提供三种专业模板可选,省去手动排版的麻烦。不过它对文档中包含复杂表格或图片时美化效果可能有限,且不支持批量处理多个文件。总体来说,质量可靠,能满足日常文档格式化的基本需求。

📊 多维度评分

适应性4.2
规范性4.3
有效性4.3
可靠性4.2
可信度5

📁 包含文件 (2 个)

📄 SKILL.md 2.9 KB
📄 scripts/beautify.py 15.5 KB