AI Agent Hub
Back to skills
Official Document Format Converter icon

Official Document Format Converter

Office Efficiency Updated 2026.08.30

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

Please follow https://skillhub.cn/install/skillhub.md to install @user_60300dde/doc-format.

About this skill

When dealing with official documents, manually adjusting formatting to meet standard rules is a tedious and error-prone task. This is especially challenging with multiple file formats, leading to inefficiency and inconsistent results.

Core Problem

Official documents require strict adherence to formatting rules, including title hierarchy, font sizes, margins, and line spacing. File formats vary—such as .docx, .doc, .wps, .txt, .md—each needing different handling. Manual adjustments involve segment-by-segment checks, risking oversight of key elements like figure/table titles or appendices.

How the Skill Works

The skill automates formatting via the scripts/wfp_cli.py script, with core capabilities:
- Automatic Structure Recognition: Detects topics, subtitles, four-level headings, second-level headings with inline body text, figure/table captions, and attachment markers.
- Multi-Format Input: Handles single files, multiple files, and recursive directory scanning, preserving the original directory structure in output.
- Flexible Configuration: Adjusts rules (fonts, margins, tables) through JSON config files (e.g., wfp_config.json), inline JSON, or command-line flags like --set.
- Special Handling: For TXT/MD, supports blank line modes (e.g., removing single blank lines, collapsing multiple to one) and preserves handwritten numbering (e.g., 1., 1.2.3) from the source.

Key steps include:
1. Check Input: Verify file paths and formats; directory inputs are processed recursively by default.
2. Configuration: Use show-config to view current settings, map user needs to fields, and save via save-config.
3. Run Formatting: Execute the script to generate standard .docx files, working on temporary copies to avoid modifying originals.
4. Output Review: Remind users to inspect titles, heading levels, page numbers, and tables to ensure correctness.

Applicability and Caveats

  • Conversion Dependencies: On Windows, processing .doc/.wps requires WPS/Word and pywin32; on macOS/Linux, it relies on LibreOffice soffice for conversion to .docx. If conversion fails, users must install LibreOffice or specify the path with --soffice.
  • Auto-Numbering Issues: Converted auto-numbering may not succeed; check numbering text, paragraph indentation, and fonts. If numbers cannot be selected individually, they may still be Word/WPS auto-numbering—convert to handwritten text and rerun if needed.
  • Enhancement Risks: Optional features like table content auto-adjustment, separate fonts for numbers/letters, and symbol standardization can affect layout. Test on copies for important documents.
  • Output Behavior: Success paths are written to stdout; detailed logs require the -v flag. Exit code 0 indicates full success, non-0 indicates partial failure.

Use Cases

  • Batch converting government document drafts from .wps to .docx, automatically applying standard heading hierarchy, margins, and line spacing for formal archiving.
  • Processing Markdown notes in team collaboration documents, selecting blank line modes to remove single blanks and preserve handwritten numbering, generating formal company reports.
  • Formatting internal company files with tables and symbols based on custom JSON config, enabling separate fonts for numbers and letters to ensure layout consistency.
  • Converting TXT meeting notes to standard .docx, automatically identifying and formatting subtitles and attachment markers for distribution to attendees.

Best For

  • Government document clerks who regularly batch-convert multi-format drafts (like .doc, .wps) into standard .docx, ensuring compliance with national formatting regulations.
  • Corporate administrative assistants responsible for unifying department-submitted mixed-format documents (.docx, .txt) into company templates and adjusting table content for layout.
  • Academic researchers converting research notes from Markdown to journal-required .docx format, preserving original numeric numbering and auto-identifying heading levels.
  • Publisher editors needing to quickly format author submissions in .wps and .doc files, applying symbol standardization and figure/table title styles to reduce manual effort.