document-processing by eyadsibai/ltk
npx skills add https://github.com/eyadsibai/ltk --skill document-processing处理办公文档:PDF、Excel、Word 和 PowerPoint。
| 格式 | 扩展名 | 结构 | 最佳用途 |
|---|---|---|---|
| 二进制/文本 | 报告、表格、存档 | ||
| Excel | .xlsx | ZIP 包中的 XML | 数据、计算、模型 |
| Word | .docx | ZIP 包中的 XML | 文本文档、合同 |
| PowerPoint | .pptx | ZIP 包中的 XML | 演示文稿、幻灯片 |
关键概念:XLSX、DOCX 和 PPTX 都是包含 XML 文件的 ZIP 压缩包。您可以解压缩它们以访问原始内容。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 任务 | 最佳工具 |
|---|---|
| 基本读写 | pypdf |
| 文本提取 | pdfplumber |
| 表格提取 | pdfplumber |
| 创建 PDF | reportlab |
| 扫描 PDF 的 OCR | pytesseract + pdf2image |
| 命令行 | qpdf, pdftotext |
| 操作 | 方法 |
|---|---|
| 合并 | 遍历文件,将页面添加到写入器 |
| 拆分 | 为每个页面创建新的写入器 |
| 提取表格 | 使用 pdfplumber,转换为 DataFrame |
| 旋转 | 在页面上调用 .rotate(degrees) |
| 加密 | 使用写入器的 .encrypt() 方法 |
| OCR | 转换为图像,运行 pytesseract |
| 任务 | 最佳工具 |
|---|---|
| 数据分析 | pandas |
| 公式与格式 | openpyxl |
| 简单 CSV | pandas |
| 财务模型 | openpyxl |
| 方法 | 结果 |
|---|---|
| 错误:在 Python 中计算,写入值 | 静态数字,数据更改时失效 |
| 正确:写入 Excel 公式 | 动态,自动重新计算 |
| 惯例 | 含义 |
|---|---|
| 蓝色文本 | 硬编码输入 |
| 黑色文本 | 公式 |
| 绿色文本 | 链接到其他工作表 |
| 黄色填充 | 需要注意 |
| 错误 | 原因 |
|---|---|
| #REF! | 无效的单元格引用 |
| #DIV/0! | 除以零 |
| #VALUE! | 错误的数据类型 |
| #NAME? | 未知的函数名 |
| 任务 | 最佳工具 |
|---|---|
| 文本提取 | pandoc |
| 创建新文档 | python-docx 或 docx-js |
| 简单编辑 | python-docx |
| 跟踪修订 | 直接编辑 XML |
| 文件 | 包含内容 |
|---|---|
word/document.xml | 主要内容 |
word/comments.xml | 批注 |
word/media/ | 图片 |
| 元素 | XML 标签 |
|---|---|
| 删除 | <w:del><w:delText>...</w:delText></w:del> |
| 插入 | <w:ins><w:t>...</w:t></w:ins> |
关键概念:对于专业/法律文档,请使用跟踪修订 XML,而不是直接替换文本。
| 任务 | 最佳工具 |
|---|---|
| 文本提取 | markitdown |
| 创建新演示文稿 | pptxgenjs (JS) 或 python-pptx |
| 编辑现有演示文稿 | 直接编辑 XML 或 python-pptx |
| 路径 | 包含内容 |
|---|---|
ppt/slides/slide{N}.xml | 幻灯片内容 |
ppt/notesSlides/ | 演讲者备注 |
ppt/slideMasters/ | 母版模板 |
ppt/media/ | 图片 |
| 原则 | 指导方针 |
|---|---|
| 字体 | 使用网页安全字体:Arial, Helvetica, Georgia |
| 布局 | 首选两列,避免垂直堆叠 |
| 层级 | 使用大小、粗细、颜色来强调 |
| 一致性 | 在幻灯片间重复模式 |
| 转换 | 工具 |
|---|---|
| 任意格式 → PDF | LibreOffice headless |
| PDF → 图像 | pdftoppm |
| DOCX → Markdown | pandoc |
| 任意格式 → 文本 | 相应的提取器 |
| 实践 | 原因 |
|---|---|
| 在 Excel 中使用公式 | 动态计算 |
| 编辑时保留格式 | 不丢失样式 |
| 测试输出能否正确打开 | 及早发现损坏 |
| 对合同使用跟踪修订 | 审计追踪 |
| 提取为 markdown 进行分析 | 更易于处理 |
| 语言 | 包 |
|---|---|
| Python | pypdf, pdfplumber, openpyxl, python-docx, python-pptx |
| JavaScript | docx, pptxgenjs |
| CLI | pandoc, qpdf, pdftotext, libreoffice |
每周安装量
554
仓库
GitHub 星标数
1
首次出现
Jan 28, 2026
安全审计
安装于
opencode530
gemini-cli529
codex527
github-copilot522
cursor521
kimi-cli509
Work with office documents: PDF, Excel, Word, and PowerPoint.
| Format | Extension | Structure | Best For |
|---|---|---|---|
| Binary/text | Reports, forms, archives | ||
| Excel | .xlsx | XML in ZIP | Data, calculations, models |
| Word | .docx | XML in ZIP | Text documents, contracts |
| PowerPoint | .pptx | XML in ZIP | Presentations, slides |
Key concept : XLSX, DOCX, and PPTX are all ZIP archives containing XML files. You can unzip them to access raw content.
| Task | Best Tool |
|---|---|
| Basic read/write | pypdf |
| Text extraction | pdfplumber |
| Table extraction | pdfplumber |
| Create PDFs | reportlab |
| OCR scanned PDFs | pytesseract + pdf2image |
| Command line | qpdf, pdftotext |
| Operation | Approach |
|---|---|
| Merge | Loop through files, add pages to writer |
| Split | Create new writer per page |
| Extract tables | Use pdfplumber, convert to DataFrame |
| Rotate | Call .rotate(degrees) on page |
| Encrypt | Use writer's .encrypt() method |
| OCR | Convert to images, run pytesseract |
| Task | Best Tool |
|---|---|
| Data analysis | pandas |
| Formulas & formatting | openpyxl |
| Simple CSV | pandas |
| Financial models | openpyxl |
| Approach | Result |
|---|---|
| Wrong : Calculate in Python, write value | Static number, breaks when data changes |
| Right : Write Excel formula | Dynamic, recalculates automatically |
| Convention | Meaning |
|---|---|
| Blue text | Hardcoded inputs |
| Black text | Formulas |
| Green text | Links to other sheets |
| Yellow fill | Needs attention |
| Error | Cause |
|---|---|
| #REF! | Invalid cell reference |
| #DIV/0! | Division by zero |
| #VALUE! | Wrong data type |
| #NAME? | Unknown function name |
| Task | Best Tool |
|---|---|
| Text extraction | pandoc |
| Create new | python-docx or docx-js |
| Simple edits | python-docx |
| Tracked changes | Direct XML editing |
| File | Contains |
|---|---|
word/document.xml | Main content |
word/comments.xml | Comments |
word/media/ | Images |
| Element | XML Tag |
|---|---|
| Deletion | <w:del><w:delText>...</w:delText></w:del> |
| Insertion | <w:ins><w:t>...</w:t></w:ins> |
Key concept : For professional/legal documents, use tracked changes XML rather than replacing text directly.
| Task | Best Tool |
|---|---|
| Text extraction | markitdown |
| Create new | pptxgenjs (JS) or python-pptx |
| Edit existing | Direct XML or python-pptx |
| Path | Contains |
|---|---|
ppt/slides/slide{N}.xml | Slide content |
ppt/notesSlides/ | Speaker notes |
ppt/slideMasters/ | Master templates |
ppt/media/ | Images |
| Principle | Guideline |
|---|---|
| Fonts | Use web-safe: Arial, Helvetica, Georgia |
| Layout | Two-column preferred, avoid vertical stacking |
| Hierarchy | Size, weight, color for emphasis |
| Consistency | Repeat patterns across slides |
| Conversion | Tool |
|---|---|
| Any → PDF | LibreOffice headless |
| PDF → Images | pdftoppm |
| DOCX → Markdown | pandoc |
| Any → Text | Appropriate extractor |
| Practice | Why |
|---|---|
| Use formulas in Excel | Dynamic calculations |
| Preserve formatting on edit | Don't lose styles |
| Test output opens correctly | Catch corruption early |
| Use tracked changes for contracts | Audit trail |
| Extract to markdown for analysis | Easier to process |
| Language | Packages |
|---|---|
| Python | pypdf, pdfplumber, openpyxl, python-docx, python-pptx |
| JavaScript | docx, pptxgenjs |
| CLI | pandoc, qpdf, pdftotext, libreoffice |
Weekly Installs
554
Repository
GitHub Stars
1
First Seen
Jan 28, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode530
gemini-cli529
codex527
github-copilot522
cursor521
kimi-cli509
Google Sheets 费用追踪器创建指南 - 使用 Google Workspace CLI 自动化记账
6,000 周安装
OpenAPI 转 TypeScript 工具 - 自动生成 API 接口与类型守卫
563 周安装
数据库模式设计器 - 内置最佳实践,自动生成生产级SQL/NoSQL数据库架构
564 周安装
Rust Unsafe代码检查器 - 安全使用Unsafe Rust的完整指南与最佳实践
564 周安装
.NET并发编程模式指南:async/await、Channels、Akka.NET选择决策树
565 周安装
韩语语法检查器 - 基于国立国语院标准的拼写、空格、语法、标点错误检测与纠正
565 周安装
技能安全扫描器 - 检测Claude技能安全漏洞,防范提示注入与恶意代码
565 周安装