Document Processing

eyadsibai/ltk/plugins/ltk-product/skills/document-processing

作者 eyadsibaif8e85697b95d8e4968cff3c49d20e632048faae9无许可证7 个星标收录于 2026年10月9日更新于 2026年10月9日仓库8个月前更新

Use when working with "PDF", "Excel", "Word", "PowerPoint", "XLSX", "DOCX", "PPTX", "spreadsheets", "presentations", "extract text", "merge documents", "convert documents", or asking about "office document manipulation"

仅含说明Documents & Office
AI 生成的概览

指导代理读取、创建、编辑和转换 PDF、Excel、Word 与 PowerPoint 办公文档。

功能
该技能是一份处理 PDF、XLSX、DOCX 和 PPTX 格式办公文档的参考指南。它按格式列出推荐的工具与软件包,说明合并、拆分、提取表格、OCR 等常见操作,并解释 Office 文件基于 ZIP 封装 XML 的内部结构。内容还涵盖 Excel 公式规范、Word 修订痕迹、PowerPoint 设计原则以及格式转换方式。
适用场景
当任务涉及读取、创建、编辑、合并、转换或提取 PDF、Excel、Word、PowerPoint 文件内容时使用。在为办公文档工作选择库或命令行工具时也适用。
运行要求
仅为说明性内容,不附带脚本。指南中提及需另行安装的外部工具与软件包,包括 Python 库(pypdf、pdfplumber、openpyxl、python-docx、python-pptx)、JavaScript 包(docx、pptxgenjs)以及命令行工具(pandoc、qpdf、pdftotext、LibreOffice、pytesseract、pdf2image)。

Document Processing Guide

Work with office documents: PDF, Excel, Word, and PowerPoint.


Format Overview

FormatExtensionStructureBest For
PDF.pdfBinary/textReports, forms, archives
Excel.xlsxXML in ZIPData, calculations, models
Word.docxXML in ZIPText documents, contracts
PowerPoint.pptxXML in ZIPPresentations, slides

Key concept: XLSX, DOCX, and PPTX are all ZIP archives containing XML files. You can unzip them to access raw content.


PDF Processing

PDF Tools

TaskBest Tool
Basic read/writepypdf
Text extractionpdfplumber
Table extractionpdfplumber
Create PDFsreportlab
OCR scanned PDFspytesseract + pdf2image
Command lineqpdf, pdftotext

Common Operations

OperationApproach
MergeLoop through files, add pages to writer
SplitCreate new writer per page
Extract tablesUse pdfplumber, convert to DataFrame
RotateCall .rotate(degrees) on page
EncryptUse writer's .encrypt() method
OCRConvert to images, run pytesseract

Excel Processing

Excel Tools

TaskBest Tool
Data analysispandas
Formulas & formattingopenpyxl
Simple CSVpandas
Financial modelsopenpyxl

Critical Rule: Use Formulas

ApproachResult
Wrong: Calculate in Python, write valueStatic number, breaks when data changes
Right: Write Excel formulaDynamic, recalculates automatically

Financial Model Standards

ConventionMeaning
Blue textHardcoded inputs
Black textFormulas
Green textLinks to other sheets
Yellow fillNeeds attention

Common Formula Errors

ErrorCause
#REF!Invalid cell reference
#DIV/0!Division by zero
#VALUE!Wrong data type
#NAME?Unknown function name

Word Processing

Word Tools

TaskBest Tool
Text extractionpandoc
Create newpython-docx or docx-js
Simple editspython-docx
Tracked changesDirect XML editing

Document Structure

FileContains
word/document.xmlMain content
word/comments.xmlComments
word/media/Images

Tracked Changes (Redlining)

ElementXML 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.


PowerPoint Processing

PowerPoint Tools

TaskBest Tool
Text extractionmarkitdown
Create newpptxgenjs (JS) or python-pptx
Edit existingDirect XML or python-pptx

Slide Structure

PathContains
ppt/slides/slide{N}.xmlSlide content
ppt/notesSlides/Speaker notes
ppt/slideMasters/Master templates
ppt/media/Images

Design Principles

PrincipleGuideline
FontsUse web-safe: Arial, Helvetica, Georgia
LayoutTwo-column preferred, avoid vertical stacking
HierarchySize, weight, color for emphasis
ConsistencyRepeat patterns across slides

Converting Between Formats

ConversionTool
Any → PDFLibreOffice headless
PDF → Imagespdftoppm
DOCX → Markdownpandoc
Any → TextAppropriate extractor

Best Practices

PracticeWhy
Use formulas in ExcelDynamic calculations
Preserve formatting on editDon't lose styles
Test output opens correctlyCatch corruption early
Use tracked changes for contractsAudit trail
Extract to markdown for analysisEasier to process

Common Packages

LanguagePackages
Pythonpypdf, pdfplumber, openpyxl, python-docx, python-pptx
JavaScriptdocx, pptxgenjs
CLIpandoc, qpdf, pdftotext, libreoffice

来源与署名

来源:eyadsibai/ltk位于plugins/ltk-product/skills/document-processing提交f8e8569

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架