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 從公開儲存庫中收錄這些內容。

檢舉或申請下架