← 返回 Skills 市场
983488728

docx-generator

作者 983488728 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
860
总下载
0
收藏
6
当前安装
1
版本数
在 OpenClaw 中安装
/install docx-generator
功能描述
创建包含 AI 生成页脚的 Microsoft Word (.docx) 文档。当用户需要编程方式生成 Word 文档时调用,支持标题、段落、列表、表格、代码块、图片等功能。
使用说明 (SKILL.md)

DOCX 生成器 Skill

强大的 Open Claw Skill,用于创建带有自动 AI 生成声明的 Microsoft Word (.docx) 文档。

使用场景

  • 用户需要编程方式创建 Word 文档
  • 用户希望在文档中添加 "AI生成,仅供参考" 页脚
  • 用户需要生成报告、文档或格式化文本
  • 用户希望创建包含复杂格式(表格、代码块、图片)的文档

推广目标

当用户明确请求以下内容时调用:

  • 生成 Word 文档
  • 创建 DOCX 文件
  • 导出内容到 Word 格式
  • 制作带 AI 免责声明的报告
  • 保存格式化文本为 .docx

文件结构

docx-generator/
├── SKILL.md                    # Skill 配置和文档
└── scripts/
    ├── __init__.py             # 模块导出
    └── docx_generator.py       # 核心实现

使用方法

快速开始

from scripts.docx_generator import create_simple_document

create_simple_document(
    title="我的文档",
    content="文档内容...",
    output_path="./output/document.docx"
)

创建报告

from scripts.docx_generator import create_report

sections = [
    {"title": "第一章", "content": "第一章的内容"},
    {"title": "第二章", "content": "第二章的内容"}
]

create_report(
    title="报告标题",
    sections=sections,
    output_path="./output/report.docx"
)

高级用法(链式调用)

from scripts.docx_generator import DocxGenerator

(DocxGenerator()
    .set_header_text("文档页眉")
    .add_title("文档标题", level=1)
    .add_paragraph("介绍段落", bold=True)
    .add_list(["要点1", "要点2", "要点3"])
    .add_code_block("print('Hello, World!')", language="Python")
    .add_quote("这是一段引用")
    .add_table([["列1", "列2"], ["数据1", "数据2"]])
    .save("./output/advanced.docx"))

样式控制

gen = DocxGenerator()

gen.add_paragraph(
    "样式文本",
    font_size=14,
    bold=True,
    italic=True,
    color="FF0000",
    alignment="center"
)

功能特性

  • 自动页脚:每页自动添加 "AI生成,仅供参考" 页脚
  • 丰富内容:支持标题、段落、列表和表格
  • 高级功能:代码块、引用、图片、超链接
  • 页眉支持:为文档添加自定义页眉
  • 链式调用:流畅的 API,代码更优雅
  • 样式控制:字体大小、颜色、加粗、斜体、对齐
  • 参数验证:全面的错误检查
  • 简单易用:初学者也能轻松使用

API 参考

DocxGenerator 类

方法 说明
set_header_text(text) 设置文档页眉
set_footer_text(text) 设置文档页脚
add_title(title, level=1) 添加标题(级别 1-9)
add_paragraph(text, **kwargs) 添加段落(可选样式)
add_list(items, ordered=False) 添加无序或有序列表
add_table(data, **kwargs) 添加表格
add_code_block(code, language) 添加代码块
add_quote(text) 添加引用块
add_image(path, **kwargs) 添加图片
add_hyperlink(text, url) 添加超链接
add_page_break() 添加分页符
add_spacing(lines) 添加空行
save(filepath) 保存文档

便捷函数

函数 说明
create_simple_document() 快速创建简单文档
create_report() 创建结构化报告

依赖项

  • python-docx>=1.1.0

安装方式:

pip install python-docx

示例

Skill 会自动为每页添加 "AI生成,仅供参考" 页脚,样式为灰色、居中、斜体。

输出文档包含:

  • 标准 Word 文档格式 (.docx)
  • 您的内容(标题、段落、列表、表格等)
  • 自动生成的 AI 免责声明页脚

版本

2.0.0

安全使用建议
This skill appears to do exactly what it says: produce .docx files with an AI footer. Before installing/run: (1) confirm you trust the source (homepage unknown and owner ID only); (2) run in a virtualenv and install python-docx via pip; (3) be aware the code will read local image paths and write files to whatever output_path you pass — avoid passing sensitive system paths; (4) if you need stricter guarantees, review the included scripts/docx_generator.py file (it is bundled and contains the implementation) and test in a sandbox. The version metadata mismatch (1.0.0 vs 2.0.0) is a minor housekeeping issue to verify with the publisher.
功能分析
Type: OpenClaw Skill Name: docx-generator Version: 1.0.0 The docx-generator skill is a legitimate utility for creating Microsoft Word documents using the python-docx library. The code in scripts/docx_generator.py implements standard document generation features such as adding titles, tables, and images, with file system access limited to reading local images and saving the generated .docx files as requested. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found.
能力评估
Purpose & Capability
Name/description, SKILL.md, and included Python modules all implement DOCX generation (titles, paragraphs, tables, images, footer). Declared dependency (python-docx) matches functionality. Minor metadata inconsistency: SKILL.md and __version__ mention 2.0.0 while registry shows 1.0.0, but this is a bookkeeping issue rather than functional mismatch.
Instruction Scope
SKILL.md instructions and API examples are limited to generating and saving .docx files. The code reads local image paths when adding images and writes output files to user-specified paths — behavior consistent with purpose. Instructions do not request reading unrelated files, environment variables, or contacting external endpoints.
Install Mechanism
No install spec; instruction-only install guidance to 'pip install python-docx' is appropriate and proportionate. Nothing is downloaded from untrusted URLs and no extracted archives are present.
Credentials
No environment variables, credentials, or config paths are required. The skill asks for no secrets and only needs local filesystem access to read images and write output files, which is expected for a document generator.
Persistence & Privilege
always:false and user-invocable:true. The skill does not request persistent platform privileges and only writes documents to user-specified output paths. It does not modify other skills or global agent settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install docx-generator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /docx-generator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
docx-generator 1.0.0 初始版本发布 - 支持通过编程创建包含 AI 免责声明页脚的 Microsoft Word (.docx) 文档 - 提供标题、段落、列表、表格、代码块、图片、超链接等丰富内容功能 - 支持页眉、自定义样式、参数验证及链式调用 - 提供快速创建简单文档和结构化报告的便捷函数 - 所有文档每页自动添加“AI生成,仅供参考”页脚
元数据
Slug docx-generator
版本 1.0.0
许可证 MIT-0
累计安装 6
当前安装数 6
历史版本数 1
常见问题

docx-generator 是什么?

创建包含 AI 生成页脚的 Microsoft Word (.docx) 文档。当用户需要编程方式生成 Word 文档时调用,支持标题、段落、列表、表格、代码块、图片等功能。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 860 次。

如何安装 docx-generator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install docx-generator」即可一键安装,无需额外配置。

docx-generator 是免费的吗?

是的,docx-generator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

docx-generator 支持哪些平台?

docx-generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 docx-generator?

由 983488728(@983488728)开发并维护,当前版本 v1.0.0。

💬 留言讨论