OpenParable
Skip to content
← Back to skills

Docx Pack

Documents
docx_pack

Docx Pack is an Agent Skill for documents published in the cas-bigdatalab/piflow repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

将解压的XML目录重新打包为DOCX文件

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/cas-bigdatalab/piflow/blob/HEAD/workspace/skills/docx_pack/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/docx-pack, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

docx_pack 技能

功能说明

该技能将解压的XML目录重新打包为DOCX文件,与docx_unpack技能配合使用,实现DOCX文件的编辑和重建。

核心功能

  • 将XML目录打包为标准DOCX文件
  • 自动修复常见问题(durableId溢出、空格保留等)
  • 自动创建输出目录
  • 支持UTF-8编码

使用方法

python scripts/run_docx_pack.py --input_dir <XML目录> --output_path <输出DOCX> [--validate]

参数说明

参数类型必填默认值说明
input_dirstring是-解压的XML目录路径
output_pathstring是-输出DOCX文件路径
originalstring否-原始DOCX文件路径(用于参考)
validatebool否true是否启用自动修复

示例

python scripts/run_docx_pack.py --input_dir ./unpacked/ --output_path modified.docx

自动修复功能

当启用validate时,会自动修复以下问题:

  • durableId值超过0x7FFFFFFF的问题
  • w:t元素前后空格丢失问题(添加xml:space="preserve")

注意事项

  • 输入目录必须包含有效的DOCX XML结构
  • 输出目录不存在时会自动创建
  • 打包后的DOCX文件应能被Word等软件正常打开