AI Agent Hub
Back to skills
Word Auto-Format icon

Word Auto-Format

Office Efficiency Updated 2026.08.29

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_e41a5bf9/wsj-word-format.

About this skill

The Problem

Word documents often spend more time in formatting passes than in writing: margins, fonts, heading levels, line spacing, and figure or table captions need to be consistent. Chinese documents make this harder because East Asian and Latin fonts are often set separately. word-auto-format targets .docx files and turns common formatting rules into repeatable profiles instead of manual point-by-point edits.

How It Works

The core script is scripts/word_formatter.py, built on python-docx. A typical run checks dependencies, selects one of the academic, business, or default profiles, executes the formatter, and reports the output statistics and backup file. It normalizes page margins, sets Chinese and English body fonts separately, applies a fixed 1.5 line spacing, and handles first-line indentation in the academic and default profiles.

  • Heading detection: supports common patterns such as Chapter 1, 1., and 1.1, then applies consistent heading font, color, and spacing
  • Figure and table captions: centers common captions like Figure 1, Table 1, 图1, and 表1
  • Table styling: sets vertical alignment in cells and adjusts font size
  • Backup: creates _backup.docx before formatting, making comparison and rollback easier

For specific fonts, line spacing, or colors, edit the PROFILES dictionary or add a custom profile and call it with --profile; see references/formatting_guide.md for parameter details.

Boundaries and Notes

This skill only processes .docx; older .doc files must be saved as .docx first. Heading recognition is regex-based, so non-standard numbering, bare numeric lines, or all-caps English lines may be missed. Complex layouts such as multiple columns or text boxes are not handled. Use it with python-docx 0.8.x, and treat the result as a formatted draft that still needs a final check against the target template.

Use Cases

  • Before thesis submission, normalize chapter numbering, line spacing, indentation, and heading styles with the academic profile.
  • Apply the business profile to a client proposal to set Microsoft YaHei, Calibri, blue headings, and no first-line indentation.
  • Tidy a .docx draft with `Chapter 1` and `1.1` headings so heading levels, captions, and table cell styles look consistent.
  • Create `_backup.docx` before formatting, then compare margins, fonts, and spacing after the script runs.

Best For

  • Graduate or undergraduate thesis writers who need consistent Song/Times New Roman text, 1.5 line spacing, and chapter heading styles.
  • Product, consulting, or client-facing writers who need Microsoft YaHei, blue headings, and business-report spacing.
  • Editors or operations staff who need to align `Chapter 1`, `1.1` headings, captions, and table styling in a draft.
  • Administrative or project staff maintaining document templates who need quick before/after formatting checks with backups.