← 返回
未分类 中文

Word Handler

Create, read, and edit Word documents (.docx) with support for templates, tables, and styling.
创建、读取和编辑Word文档(.docx),支持模板、表格和样式。
cjboy007 cjboy007 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 358
下载
💾 0
安装
1
版本
#latest

概述

When to Use

User needs to create, read, or edit Word documents (.docx). Supports template filling, table generation, and professional styling.

Architecture

This skill uses python-docx for DOCX manipulation. All processing happens locally.

Quick Reference

TopicFile
-------------
Generate Quotationscripts/generate_quotation_docx.py

Core Rules

1. Use Templates for Consistency

When generating documents repeatedly (quotations, proposals), use templates with placeholder text that gets replaced.

2. Handle Chinese Filenames Carefully

Use glob wildcards or pathlib for Chinese filename compatibility:

from pathlib import Path
for f in Path(".").glob("*.docx"):
    doc = Document(str(f))

3. Tables Need Explicit Styling

Word tables require explicit border and cell styling. Use Table Grid style as baseline.

4. Section Properties Control Layout

Page margins, orientation, and headers/footers are controlled at section level:

for section in doc.sections:
    section.left_margin = Cm(2.5)
    section.right_margin = Cm(2.5)

5. Runs vs Paragraphs

Text formatting happens at run level. A paragraph can contain multiple runs with different styles.

Common Traps

  • Merged cells - Only top-left cell holds value in merged ranges
  • Page breaks - Insert explicitly with doc.add_page_break()
  • Images - Require absolute paths or file-like objects
  • Styles - Built-in styles vary by Word version; test compatibility

Dependencies

pip3 install python-docx

Security & Privacy

Data that stays local:

  • All file processing happens locally
  • No external services called

This skill does NOT:

  • Send data to external endpoints
  • Require network access

Related Skills

  • read-docx — Read-only DOCX extraction
  • excel-xlsx — Excel file handling
  • pdf-text-extractor — PDF text extraction

Feedback

  • If useful: clawhub star word-docx
  • Stay updated: clawhub sync

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 10:06 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

business-ops

Order Tracker

cjboy007
跟踪和管理销售订单,支持状态更新、通知和仪表盘报表。提供订单创建、状态转换(待处理/已确认/...)等功能。
★ 0 📥 584
office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 461 📥 153,937
office-efficiency

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 931 📥 187,175