一键导入
docx
Extract text and tables from Word (.docx) files. Use when a user uploads a Word document that needs to be processed.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Extract text and tables from Word (.docx) files. Use when a user uploads a Word document that needs to be processed.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Extract text and tables from PowerPoint (.pptx) files. Use when a user uploads a PPT or PPTX document that needs to be processed.
当用户请求生成、创建、制作 PPT、演示文稿、课件时使用此技能。这是教育场景中最常用的技能,适合老师备课、课程汇报、学术演讲等需求。
Extract text and tables from Markdown (.md) files. Use when a user uploads a Markdown document that needs to be processed.
Extract text and tables from PDF files. Use when a user uploads a PDF document that needs to be processed.
Summarize and structure raw document text (PDF/Word/Markdown/PPT) into a format optimized for PPT generation. Use when the user uploads a document and wants to generate a presentation from it.
Use this skill any time a .pptx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates, layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx filename, regardless of what they plan to do with the content afterward. If a .pptx file needs to be opened, created, or touched, use this skill.
| name | docx |
| description | Extract text and tables from Word (.docx) files. Use when a user uploads a Word document that needs to be processed. |
Extract readable text and structured tables from DOCX files. This skill feeds extracted content into downstream processing (e.g., document summarization for PPT generation).
.docx or .doc file.doc files must be converted to .docx firstfrom docx import Document
doc = Document("document.docx")
# Extract paragraphs (skip empty)
paragraphs = [p.text.strip() for p in doc.paragraphs if p.text.strip()]
raw_text = "\n\n".join(paragraphs)
# Extract tables
tables = []
for table in doc.tables:
rows_data = []
for row in table.rows:
cells = [cell.text.strip() for cell in row.cells]
rows_data.append(cells)
if rows_data:
tables.append(rows_data)
Why python-docx:
# Convert to plain text
pandoc document.docx -o output.txt --to plain
# Preserve more formatting
pandoc document.docx -o output.md --to markdown
# Track changes (if present)
pandoc document.docx -o output.txt --track-changes=all
import subprocess
result = subprocess.run(
["pandoc", "document.docx", "-o", "-", "--to", "plain"],
capture_output=True, text=True, timeout=60
)
if result.returncode == 0:
raw_text = result.stdout
Use pandoc when:
Convert to .docx first using LibreOffice:
soffice --headless --convert-to docx document.doc
Then process as .docx (Step 1 or 2).
| Problem | Solution |
|---|---|
.doc not .docx | Convert with LibreOffice first |
| Empty paragraphs | Filter if p.text.strip() |
| Table cells with nested content | Use .text on each cell (simplest) |
| Track changes in document | Use pandoc with --track-changes=all |
| python-docx not installed | Use pandoc fallback |
| pandoc not installed | Use LibreOffice to convert to text |
paragraph.style.name for "Heading 1", "Heading 2", etc.run.bold and run.italic for emphasis# Preserve heading structure
for para in doc.paragraphs:
style = para.style.name
if "Heading" in style:
level = style # "Heading 1", "Heading 2", etc.
text = para.text.strip()
# ... heading with level
For pptagent pipeline:
max(1, len(paragraphs) // 30) (rough estimate)Return (raw_text: str, tables: list[list[list[str]]], estimated_pages: int):
raw_text: paragraphs joined with double newlinestables: list of tables, each table is list[list[str]] (rows → cells)estimated_pages: rough page estimate based on paragraph count