Summary
docx 格式刷:从模板 Word 文档提取格式指纹(字体/字号/行距/缩进/对齐/表格边框/封面/分页),然后统一应用到目标 docx,做到与模板格式完全一致。触发词:格式刷、格式统一、统一格式、套用模板格式、参照模板格式、docx格式修复、Word格式不一致、pandoc转出来的docx格式乱、按模板生成docx、…
tjxj/z-skills
docx 格式刷:从模板 Word 文档提取格式指纹(字体/字号/行距/缩进/对齐/表格边框/封面/分页),然后统一应用到目标 docx,做到与模板格式完?
npx skills add tjxj/z-skills --skill z-docx-format-brush
docx 格式刷:从模板 Word 文档提取格式指纹(字体/字号/行距/缩进/对齐/表格边框/封面/分页),然后统一应用到目标 docx,做到与模板格式完全一致。触发词:格式刷、格式统一、统一格式、套用模板格式、参照模板格式、docx格式修复、Word格式不一致、pandoc转出来的docx格式乱、按模板生成docx、…
Related neighbors and high-traction skills in the same topics — useful to compare before installing.
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybr…
568.2K installsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or bot…
216.8K installsUse this skill whenever the user wants to do anything with PDF files. This includes reading or …
192.4K installsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.do…
184.5K installsUse this skill any time a spreadsheet file is the primary input or output. This means any task …
165K installsOther skills from tjxj/z-skills · top by installs.
npx skills add tjxj/z-skills
Declared 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
5,118 B
SUMMARY.md
627 B
把一份模板 docx 的格式"刷"到另一份 docx 上。核心思想:格式参数从模板实测出来,收敛到唯一出口应用,凭感觉手调必然不统一。
python3 scripts/extract_fingerprint.py "模板.docx"
输出模板的格式指纹(JSON + 可读摘要):
为什么要实测而非只看样式表:中文公文类 docx 几乎都在 run 层直接设置仿宋等字体,样式表里可能还是默认值。只信样式表必然刷错。
python3 scripts/extract_fingerprint.py "目标.docx"
对比两份指纹,列出病灶清单。pandoc 产物的典型病灶:
"xxx" 被转成 ”xxx“)python3 scripts/apply_format.py "目标.docx" --config fingerprint.json [--out "输出.docx"]
不带 --out 时原地修复。脚本按五层顺序应用(顺序重要,样式层先兜底,run 层再精确覆盖):
第X章 型 Heading 1 居中 + pageBreakBefore“xxx”run.font.name 只管西文;必须再 rPr.rFonts.set(qn('w:eastAsia'), '仿宋'),否则 Word 中文回落宋体磅 = EMU / 12700(如 152400 = 12磅,203200 = 16磅)r.font.color.rgb = None 不够,需从 rPr 中 remove w:color 元素w:pageBreakBefore 元素,优于插入分页符 runscripts/genfromtemplate.py。脚本内的 title()、para() 和 table() 工厂统一应用指纹参数,所有内容只从工厂函数写入。python3 scripts/gen_from_template.py "content.json" \
--config fingerprint.json \
--out "output/doc/输出.docx"
内容 JSON 使用 cover 和 blocks。blocks 支持 heading、paragraph、table、page_break;完整示例见脚本顶部说明。
python3 scripts/verify_format.py "输出.docx"
通过标准:
第X章 Heading 1 有 pageBreakBefore验证输出贴给用户看,用表格汇报"病灶 → 修复"对照。
output/doc/