python-docx
提供基于python-docx库的标准方法,支持生成带封面、标题、段落、列表、表格与图片的专业Word文档。 Skill: python-docx Owner: fooying Summary: 提供基于python-docx库的标准方法,支持生成带封面、标题、段落、列表、表格与图片的专业Word文档。 Tags: latest:1.0.0 Version history: v1.0.0 | 2026-05-03T10:50:37.683Z | user python-docx Skill 1.0.0 initial release: - Provides standard code templates and best practices for generating professional Word documents with python-docx. - Includes functions for document initialization, font settings, headings, paragraphs, bu
Rank
62
Safety
84
Downloads
1.3k
Updated
Oct 10, 2026
Version
1.0.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 1.3K downloads reported by the source. Last updated 10/10/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Oct 10, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Oct 10, 2026
- Adoption signal
- 1.3K downloadsadoption · observed Oct 10, 2026
- Latest release
- 1.0.0release · observed May 3, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install s172d0nd81xtkz14rc6g1wdmj183x0mv:python-docx- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-fooying-python-docx/snapshot"
Documentation
CLAWHUB
9,691 characters of source documentation, loaded on request.
Extracted files
3 files captured from the source.
SKILL.md
# python-docx Skill
## 概述
本Skill提供使用python-docx生成专业Word文档的标准方法和最佳实践。
## 适用场景
- 生成安全服务方案文档
- 生成技术架构设计文档
- 生成任何需要专业排版的Word文档
## 技术栈
- **核心库**: `python-docx`
- **辅助库**: `docx.shared`, `docx.enum`, `docx.oxml.ns`
## 标准代码模板
### 1. 文档初始化
```python
from docx import Document
from docx.shared import Inches, Pt, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT
from docx.oxml.ns import qn
def create_document():
"""创建标准文档"""
doc = Document()
# 设置默认字体(关键!)
style = doc.styles['Normal']
style.font.name = 'Microsoft YaHei'
style._element.rPr.rFonts.set(qn('w:eastAsia'), 'Microsoft YaHei')
return doc
```
### 2. 字体设置(必须!)
```python
def set_font(run, font_name='Microsoft YaHei'):
"""设置字体"""
run.font.name = font_name
run._element.rPr.rFonts.set(qn('w:eastAsia'), font_name)
```
### 3. 标题添加
```python
def add_heading_custom(doc, text, level=1):
"""
添加标准标题
Args:
doc: Document对象
text: 标题文本
level: 1=一级, 2=二级, 3=三级
Returns:
标题段落对象
"""
heading = doc.add_heading(level=level)
run = heading.add_run(text)
set_font(run)
if level == 1:
run.font.size = Pt(16)
run.font.color.rgb = RGBColor(0, 51, 102)
run.font.bold = True
elif level == 2:
run.font.size = Pt(14)
run.font.color.rgb = RGBColor(0, 51, 102)
run.font.bold = True
else:
run.font.size = Pt(12)
run.font.color.rgb = RGBColor(0, 0, 0)
run.font.bold = True
return heading
```
### 4. 段落添加
```python
def add_para_custom(doc, text, bold=False, indent=0, color=None):
"""
添加标准段落
Args:
doc: Document对象
text: 段落文本
bold: 是否加粗
indent: 首行缩进(厘米)
color: RGBColor颜色对象
Returns:
段落对象
"""
p = doc.add_paragraph()
p.paragraph_format.first_line_indent = Cm(indent)
run = p.add_run(text)
run.font.size = Pt(11)
set_font(run)
if bold:
run.font.bold = True
if color:
run.font.color.rgb = color
return p
```
### 5. 项目符号列表
```python
def add_bullet_custom(doc, text, level=0):
"""
添加项目符号段落
Args:
doc: Document对象
text: 列表项文本
level: 缩进级别(0=一级, 1=二级)
Returns:
段落对象
"""
p = doc.add_paragraph(style='List Bullet')
p.paragraph_format.left_indent = Cm(0.5 + level * 0.5)
run = p.add_run(text)
run.font.size = Pt(11)
set_font(run)
return p
```
### 6. 编号列表
```python
def add_numbered_custom(doc, text, level=0):
"""
添加编号列表段落
Args:
doc: Document对象
text: 列表项文本
level: 缩进级别
Returns:
段落对象
"""
p = doc.add_paragraph(style='List Number')
p.paragraph_format.left_indent = Cm(0.5 + level * 0.5)
run = p.add_run(text)
run.font.size = Pt(11)
set_font(run)
return p
```
### 7. 表格创建
```python
def create_table(doc, headers, data):
"""
创建标准_meta.json
{
"ownerId": "kn7f8gnqy196bx27h0m3fj5nfh82432j",
"slug": "python-docx",
"version": "1.0.0",
"publishedAt": 1777805437683
}skill-card.md
## Description: Provides Chinese-oriented python-docx guidance and reusable code templates for generating professionally formatted Word documents with covers, headings, paragraphs, lists, tables, images, and pagination. This skill is ready for commercial/non-commercial use. ## Publisher: [fooying](https://clawhub.ai/user/fooying) ### License/Terms of Use: MIT-0 ## Use Case: Developers and agents use this skill as a formatting reference when creating Word documents with python-docx, especially Chinese-language service proposals, architecture designs, and other professionally structured documents. ### Deployment Geography for Use: Global ## Known Risks and Mitigations: Risk: Copied examples may write a DOCX file with the sample output filename or use the default Microsoft YaHei font without project review. Mitigation: Review and adjust the output filename, font choices, and document paths before running copied code in a real project. ## Reference(s): - [python-docx official documentation](https://python-docx.readthedocs.io/) ## Skill Output: **Output Type(s):** [Markdown, Code, Guidance] **Output Format:** [Markdown with Python code blocks] **Output Parameters:** [1D] **Other Properties Related to Output:** [Produces reusable python-docx snippets and troubleshooting guidance; example code writes a local DOCX file.] ## Skill Version(s): 1.0.0 (source: server release evidence) ## Ethical Considerations: Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
activepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/fooying/skills/python-docx",
"sourceUrl": "https://clawhub.ai/fooying/skills/python-docx",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T20:04:30.173Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-fooying-python-docx/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-fooying-python-docx/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-10-10T20:04:30.173Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "1.3K downloads",
"href": "https://clawhub.ai/fooying/python-docx",
"sourceUrl": "https://clawhub.ai/fooying/python-docx",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-10-10T20:04:30.173Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.0.0",
"href": "https://clawhub.ai/fooying/python-docx",
"sourceUrl": "https://clawhub.ai/fooying/python-docx",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-03T10:50:37.683Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-fooying-python-docx/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-fooying-python-docx/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.0.0",
"description": "python-docx Skill 1.0.0 initial release: - Provides standard code templates and best practices for generating professional Word documents with python-docx. - Includes functions for document initialization, font settings, headings, paragraphs, bullet/numbered lists, tables, image insertion, pagination, and cover page creation. - Offers a complete example of generating a document with structured content. - Adds troubleshooting tips for common issues in using python-docx. - Lists core and auxiliary library dependencies, and links to official documentation.",
"href": "https://clawhub.ai/fooying/python-docx",
"sourceUrl": "https://clawhub.ai/fooying/python-docx",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-05-03T10:50:37.683Z",
"isPublic": true
}
]
}Record generated Oct 10, 2026.
