office-toolkit

处理 Office 文档(Word/Excel/PPT/PDF)的技能。当用户要求读取、创建、编辑 Word 文档(.docx)、Excel 表格(.xlsx/.csv)、PPT(.pptx)或 PDF 时使用。基于 python-docx、openpyxl、python-pptx、pypdf 库。Requires: python-docx, openpyxl, python-pptx, pypdf, pandoc, LibreOffice(验证用)。

3,891 stars

Best use case

office-toolkit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

处理 Office 文档(Word/Excel/PPT/PDF)的技能。当用户要求读取、创建、编辑 Word 文档(.docx)、Excel 表格(.xlsx/.csv)、PPT(.pptx)或 PDF 时使用。基于 python-docx、openpyxl、python-pptx、pypdf 库。Requires: python-docx, openpyxl, python-pptx, pypdf, pandoc, LibreOffice(验证用)。

Teams using office-toolkit should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/openclaw-office-toolkit/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/axelhu/openclaw-office-toolkit/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/openclaw-office-toolkit/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How office-toolkit Compares

Feature / Agentoffice-toolkitStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

处理 Office 文档(Word/Excel/PPT/PDF)的技能。当用户要求读取、创建、编辑 Word 文档(.docx)、Excel 表格(.xlsx/.csv)、PPT(.pptx)或 PDF 时使用。基于 python-docx、openpyxl、python-pptx、pypdf 库。Requires: python-docx, openpyxl, python-pptx, pypdf, pandoc, LibreOffice(验证用)。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# office-toolkit

处理 Office 文档:Word(.docx)、Excel(.xlsx/.csv)、PPT(.pptx)、PDF。

## 环境要求

```bash
pip install --break-system-packages python-docx openpyxl python-pptx pypdf
sudo apt install libreoffice-writer libreoffice-calc libreoffice-impress pandoc
```

## 快速参考

| 任务 | 库/命令 |
|------|---------|
| 读 Word | `python-docx` 或 `pandoc -t markdown` |
| 创建/编辑 Word | `python-docx` |
| 读 Excel | `openpyxl` 或 `pandas` |
| 创建/编辑 Excel | `openpyxl` |
| 读 PPT | `python-pptx` |
| 创建/编辑 PPT | `python-pptx` |
| 读 PDF | `pypdf` 或 `pandoc` |
| PDF 格式验证 | LibreOffice `soffice` |
| PDF 转图片 | `pdftoppm` (poppler-utils) |

---

## Word (.docx)

### 读取
```python
from docx import Document
doc = Document('file.docx')
for para in doc.paragraphs:
    print(para.text)

# 带格式提取
import subprocess
result = subprocess.run(['pandoc', '--track-changes=all', 'file.docx', '-t', 'markdown'], 
    capture_output=True, text=True)
print(result.stdout)
```

### 创建
```python
from docx import Document
from docx.shared import Pt, Inches

doc = Document()
# 标题
doc.add_heading('文档标题', 0)

# 段落
p = doc.add_paragraph('正文内容')
p.runs[0].bold = True  # 加粗
p.runs[0].font.size = Pt(12)
p.runs[0].font.name = 'Arial'

# 引用
doc.add_paragraph('引用内容', style='Intense Quote')

# 表格
table = doc.add_table(rows=2, cols=3)
table.style = 'Light Grid Accent 1'
table.rows[0].cells[0].text = '表头1'
table.rows[0].cells[1].text = '表头2'

doc.save('output.docx')
```

### 编辑现有文档
1. 解压 → 修改 XML → 重新打包(推荐用 python-docx 直接修改)
2. 复杂格式建议用 LibreOffice 打开编辑

---

## Excel (.xlsx)

### 读取
```python
import openpyxl
wb = openpyxl.load_workbook('file.xlsx')
ws = wb.active
for row in ws.iter_rows(values_only=True):
    print(row)
```

### 创建/编辑
```python
import openpyxl
from openpyxl.styles import Font, PatternFill, Alignment

wb = openpyxl.Workbook()
ws = wb.active
ws.title = '数据'

# 写入
ws['A1'] = '姓名'
ws['B1'] = '年龄'
ws['A2'] = '张三'
ws['B2'] = 25

# 格式化
header_fill = PatternFill(start_color='4472C4', end_color='4472C4', fill_type='solid')
ws['A1'].fill = header_fill
ws['A1'].font = Font(color='FFFFFF', bold=True)
ws['A1'].alignment = Alignment(horizontal='center')

# 保存
wb.save('output.xlsx')
```

### 格式化规则(财务场景)
- 蓝色字体:硬编码输入值
- 黑色字体:公式/计算
- 绿色字体:同文件内链接
- 红色字体:外部链接
- 黄色背景:需要关注的假设

---

## PowerPoint (.pptx)

### 读取
```python
from pptx import Presentation
prs = Presentation('file.pptx')
for slide in prs.slides:
    for shape in slide.shapes:
        if hasattr(shape, 'text'):
            print(shape.text)
```

### 创建
```python
from pptx import Presentation
from pptx.util import Inches, Pt

prs = Presentation()
prs.slide_width = Inches(10)
prs.slide_height = Inches(7.5)

# 使用空白布局
slide = prs.slides.add_slide(prs.slide_layouts[6])
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = '演示标题'
subtitle.text = '副标题'

prs.save('output.pptx')
```

### 设计原则
- **颜色方案**:选一个大胆的配色,主色占60-70%,1-2个辅助色,1个尖锐强调色
- **不要默认蓝色**:根据主题选配色
- **深浅对比**:标题页用深色背景,结论页用浅色背景("三明治"结构)
- **排版留白**:不要堆满,留呼吸空间

---

## PDF

### 读取
```python
from pypdf import PdfReader
reader = PdfReader('file.pdf')
print(f'页数: {len(reader.pages)}')
for page in reader.pages:
    print(page.extract_text())
```

### 合并
```python
from pypdf import PdfWriter, PdfReader
writer = PdfWriter()
for pdf_file in ['doc1.pdf', 'doc2.pdf']:
    reader = PdfReader(pdf_file)
    for page in reader.pages:
        writer.add_page(page)
with open('merged.pdf', 'wb') as f:
    writer.write(f)
```

### 分割
```python
reader = PdfReader('input.pdf')
for i, page in enumerate(reader.pages):
    writer = PdfWriter()
    writer.add_page(page)
    with open(f'page_{i+1}.pdf', 'wb') as f:
        writer.write(f)
```

### 旋转
```python
page = reader.pages[0]
page.rotate(90)  # 顺时针90度
```

---

## 依赖安装(当前环境状态)

| 依赖 | 状态 |
|------|------|
| python-docx | ✅ 已安装 |
| openpyxl | ✅ 已安装 |
| python-pptx | ✅ 已安装 |
| pypdf | ✅ 已安装 |
| pandoc | ✅ 已安装 |
| LibreOffice | ✅ 已安装 |

---

## Agent Rules

- 创建文件前先确保目录可写
- 复杂文档先尝试 python-docx 等库,库无法处理再用 LibreOffice
- PDF 读取优先用 `pypdf`,文字提取效果差时用 `pandoc`
- Excel 格式化参照财务规范(蓝/黑/绿/红字体 + 黄色背景)
- LibreOffice 路径:`soffice` 或 `libreoffice`(已安装)
- 收到文件路径时,先检查文件是否存在:`pathlib.Path(path).exists()`

Related Skills

AI Coding Toolkit — Master Every AI Coding Assistant

3891
from openclaw/skills

> The complete methodology for 10X productivity with AI-assisted development. Covers Cursor, Windsurf, Cline, Aider, Claude Code, GitHub Copilot, and more — tool-agnostic principles that work everywhere.

star-office-ui

3891
from openclaw/skills

Star Office UI 一键化 Skill:帮主人快速部署像素办公室看板,支持多 Agent 加入、状态可视化、移动端查看与公网访问。

Workflow & Productivity

office-web-slide

3891
from openclaw/skills

网页端 Slide 生成 Skill。当用户需要制作演示文稿(Slide / PPT / 演示)、生成幻灯片、创建展示页面时触发。 用户提供素材或通过对话引导,Agent 自动生成可在浏览器中直接打开的交互式 HTML Slide。 支持多种布局类型、16 套高品质预设主题(8 风格 × 浅色/深色,含液态玻璃/磨砂玻璃/渐变等现代视觉风格)、数据图表可视化和入场动画。

office-docs

3891
from openclaw/skills

Comprehensive document processing for Microsoft Word (.docx) and WPS Office files. Use when Codex needs to work with professional documents for: (1) Creating new documents, (2) Modifying or editing content, (3) Converting between formats, (4) Extracting text and metadata, (5) Troubleshooting document issues, (6) Batch processing documents, or any other Office document tasks.

Feishu SuperToolkit

3891
from openclaw/skills

飞书超级工具包 - 集成文件发送(含音频卡片)、日历、审批、多维表格、通讯录、考勤六大模块

office-hours

3891
from openclaw/skills

Structured brainstorming session — two modes. Startup mode: six forcing questions that expose demand reality, status quo, desperate specificity, narrowest wedge, observation, and future-fit. Builder mode: design thinking for side projects, hackathons, learning, and open source. Produces a design doc. Use when: "brainstorm this", "I have an idea", "help me think through this", "office hours", "is this worth building". Use before plan-ceo-review or plan-eng-review.

compliance-officer

3891
from openclaw/skills

Reviews marketing content against FTC, HIPAA, GDPR, SEC 482, SEC Marketing, CCPA, COPPA, and CAN-SPAM — 208 specific laws with URLs.

🔮 Divination — Oracle Toolkit for AI Agents

3891
from openclaw/skills

*"At every crossroads lies a message. Chance is the messenger. You are the reader."*

chief-creative-officer

3891
from openclaw/skills

AI agent for chief creative officer tasks

prompt-engineer-toolkit

3891
from openclaw/skills

Analyzes and rewrites prompts for better AI output, creates reusable prompt templates for marketing use cases (ad copy, email campaigns, social media), and structures end-to-end AI content workflows. Use when the user wants to improve prompts for AI-assisted marketing, build prompt templates, or optimize AI content workflows. Also use when the user mentions 'prompt engineering,' 'improve my prompts,' 'AI writing quality,' 'prompt templates,' or 'AI content workflow.'

product-manager-toolkit

3891
from openclaw/skills

Comprehensive toolkit for product managers including RICE prioritization, customer interview analysis, PRD templates, discovery frameworks, and go-to-market strategies. Use for feature prioritization, user research synthesis, requirement documentation, and product strategy development.

openrouter-toolkit

3891
from openclaw/skills

The definitive OpenRouter skill — intelligent model routing by task type, cost tracking with budget alerts, automatic fallback chains, side-by-side model comparison, and savings recommendations. Use for optimizing AI model selection, controlling costs, and building resilient LLM pipelines.