一键导入
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 职业分类
Plan page-level PPT outlines, audience adaptation, and visual-mode semantics for the deck.
PPT visual production rules, local enhancements, and vendor skill composition for theme, assets, and slide generation.
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.
Extract text and tables from PowerPoint (.pptx) files. Use when a user uploads a PPTX presentation that needs to be processed.
Summarize and structure raw document text (PDF/Word) into a format optimized for PPT generation. Use when the user uploads a document and wants to generate a presentation from it.
| 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:
python scripts/office/soffice.py --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 PPT generation 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