Summary
公文格式排版工具。将 doc/docx/wps/txt/md 文档按照公文排版习惯自动格式化,输出标准 docx。支持智能识别标题层级(一、/(一)/1./(1))、题目/副标题、附件格式化、图表标题识别、页面边距、页码、行距、字体字号、TXT/MD…
cwyalpha/word-formatter-pro · Archived
?
npx skills add cwyalpha/word-formatter-pro --skill doc-format
公文格式排版工具。将 doc/docx/wps/txt/md 文档按照公文排版习惯自动格式化,输出标准 docx。支持智能识别标题层级(一、/(一)/1./(1))、题目/副标题、附件格式化、图表标题识别、页面边距、页码、行距、字体字号、TXT/MD…
This repository is archived — consider an actively maintained alternative.
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.do…
184.5K installsGuide users through a structured workflow for co-authoring documentation. Use when user wants t…
82.5K installsSearch Remotion documentation
63.8K installsRead and write Google Docs.
52K installsRelated neighbors and high-traction skills in the same topics — useful to compare before installing.
Authors, validates, and troubleshoots AWS CloudFormation templates. Covers template authoring w…
6.6K installsLinting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort…
1.8K installsRun `tao-daft convert` to convert NVIDIA TAO DAFT datasets between supported formats. Do not us…
1.6K installsRun `tao-daft validate` to check NVIDIA TAO DAFT datasets for structure, schema, and cross-refe…
1.5K installsConvert, migrate, or import AWS CloudFormation stacks or templates into Pulumi programs. Load t…
1 installs>- Use this skill when the user asks what information a Stripe Connect connected account must p…
25 installsDeclared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.
main
Files included with this skill beyond the listing page.
SKILL.md
8,078 B
SUMMARY.md
595 B
使用 scripts/wfp_cli.py 将文档按公文排版规则格式化为标准 .docx。原始文件不原地修改,Word/WPS 类文档会先复制或转换到临时副本,再执行排版。
.docx、.doc、.wps、.txt、.md。-i、位置参数输入,以及一个或多个目录;目录输入默认递归扫描,输出目录保留原结构。1.、1.2.3)按源文档保留,不自动递增重排。wfp_config.json、指定 JSON 配置文件、内联 JSON、--set key=value 和便利开关覆盖配置。scripts/wfp_cli.py。如果当前工作目录不是 Skill 目录,使用 SKILL.md 所在目录推导脚本绝对路径,或先 cd 到 Skill 目录。.docx/.doc/.wps/.txt/.md,目录默认递归处理。wfp_config.json。如果用户指定 --config 或明确给出配置文件,使用用户指定配置;否则说明将使用当前目录配置或内置默认配置。.doc/.wps 时优先使用 WPS/Word 和 pywin32;macOS/Kylin/Linux 或 COM 不可用时,CLI 会尝试调用 LibreOffice soffice 转为 .docx。如果未安装 LibreOffice,旧格式文件会记录为跳过,继续处理 .docx/.txt/.md;如用户必须处理旧格式,再提示安装 LibreOffice、用 --soffice 指定路径,或先另存为 .docx。# 单文件
python scripts/wfp_cli.py format -i report.docx
# 指定输出文件
python scripts/wfp_cli.py format -i report.docx -o report_final.docx
# 目录批量处理,默认递归并保留目录结构
python scripts/wfp_cli.py format -i ./documents -o ./documents_formatted
# 多文件
python scripts/wfp_cli.py format -i a.docx -i b.txt c.md -o ./formatted_output
# 目录批量处理,只处理当前目录
python scripts/wfp_cli.py format -i ./documents -o ./documents_formatted --no-recursive
# 使用自定义配置
python scripts/wfp_cli.py format -i input.docx --config ./wfp_config.json
# macOS/Kylin/Linux 或 COM 不可用时,可指定 soffice 处理 .doc/.wps 转换
python scripts/wfp_cli.py format -i old.doc --soffice /Applications/LibreOffice.app/Contents/MacOS/soffice
# 临时覆盖配置
python scripts/wfp_cli.py format -i input.docx --set body_size=12 --enable-table-formatting
# 正文行距改为 1.5 倍
python scripts/wfp_cli.py format -i input.docx --set line_spacing_unit=multiple --set line_spacing_multiple=1.5
# 段落缩进改为字符单位
python scripts/wfp_cli.py format -i input.docx --set paragraph_indent_unit=chars --set left_indent_chars=0 --set right_indent_chars=0 --set first_line_indent_chars=2
# 内联 JSON 覆盖配置
python scripts/wfp_cli.py format -i input.docx --config-json "{\"force_a4\": true, \"line_spacing\": 30}"
# TXT/MD 文件转换
python scripts/wfp_cli.py format -i draft.md
# 查看默认配置
python scripts/wfp_cli.py show-config
# 保存默认配置模板
python scripts/wfp_cli.py save-config
# 显示 LibreOffice 安装提示
python scripts/wfp_cli.py install-help
# 运行内置单元测试
python scripts/wfp_cli.py test
当用户要求调整字体、字号、边距、行距、表格、符号等配置时:
show-config 了解当前配置来源和值。save-config --set ... 或便利开关保存到当前目录 wfp_config.json,或保存到用户指定路径。format 处理文档。用户只要求一次性临时调整时,可用 --config-json 或 --set 直接运行 format。
行距字段默认使用磅值:正文 linespacing、题目 titlelinespacing、副标题 subtitlelinespacing、表格 tablelinespacing。如需倍数行距,将对应 linespacingunit 设为 multiple,并设置对应 linespacing_multiple;倍数默认 1.0。
段落缩进默认使用厘米:paragraphindentunit=cm 时读取 leftindentcm/rightindentcm。如需按字符缩进,设为 paragraphindentunit=chars,并使用 leftindentchars/rightindentchars/firstlineindent_chars。
.docx 绝对路径写入 stdout。-v/--verbose 时写入 stderr。0 表示没有失败;macOS/Kylin/Linux 未安装 LibreOffice 导致的 .doc/.wps 跳过会写入 stderr,但不会阻止其他文件处理。非 0 表示没有找到可处理文件或至少一个文件失败。每次完成格式化后,都要提醒用户打开输出文件抽查题目、副标题、标题层级、附件、图/表标题、页码和表格。
如果处理过 .doc/.wps 或 Word/WPS 类文档,尤其要检查自动编号。自动编号未能确认转换成功时,编号文本、段落缩进、字体字号可能没有正常格式化;如果编号无法单独选中,说明可能仍是 Word/WPS 自动编号,必要时请将其转为手写文本编号后重新运行工具。
表格内容自动调整、符号标准化属于更容易影响版面的增强项,重要文件建议在副本上检查效果。
references/cli-reference.md。references/config-reference.md。references/formatting-rules.md。format。show-config,不要凭记忆列配置。--config-json 或 --set 直接运行 format。--no-recursive。.doc/.wps 的前提是 LibreOffice soffice 可用;LibreOffice 不可用时旧格式会跳过,不要承诺可转换自动编号。