一键导入
docx-edit
DOCX: Edit an existing Word document — append content, replace text, or add tables.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
DOCX: Edit an existing Word document — append content, replace text, or add tables.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
cURL (curl): Command-line web browser alternative. Fetch webpage HTML, test site connectivity, bypass basic bot detection, and read public web content directly from the terminal.
Python as a general-purpose problem-solving capability — use it to DO things (CV, parsing, APIs, data), not just to write programs. When stuck, reach for Python and install what you need into your dedicated Tool Environment. if you need a new package and you are unsure. ask the user for guidance and confirm before installing.
GitHub CLI (gh): Manage pull requests, issues, repositories, workflows, and releases from the terminal.
DOCX: Create a new Word document with headings, paragraphs, tables, and lists.
DOCX: Read text, tables, and metadata from a Word document.
Google Calendar: Show upcoming events across all calendars.
| name | docx-edit |
| description | DOCX: Edit an existing Word document — append content, replace text, or add tables. |
| metadata | {"version":"0.22.0","maxent":{"requires":{"bins":[{"name":"python","install":{"windows":{"method":"winget","id":"Python.Python.3"},"linux":{"method":"apt","id":"python3"},"darwin":{"method":"brew","id":"python"}}}]}}} |
PREREQUISITE: Ensure
python-docxis installed:pip install python-docx
Modify an existing .docx Word document — append content, search and replace text, remove paragraphs, or add tables and headings.
python - <<'EOF'
from docx import Document
doc = Document("existing.docx")
# ... make changes ...
doc.save("existing.docx") # overwrite in place
EOF
Always read the file with
docx-readfirst to understand its current structure before editing.
python - <<'EOF'
from docx import Document
doc = Document("report.docx")
doc.add_paragraph("Appended paragraph at the end.")
doc.save("report.docx")
EOF
python - <<'EOF'
from docx import Document
doc = Document("report.docx")
doc.add_heading("New Section", level=1)
doc.add_paragraph("Content for the new section.")
doc.save("report.docx")
EOF
python - <<'EOF'
from docx import Document
doc = Document("report.docx")
old, new = "Q3 2024", "Q4 2024"
for para in doc.paragraphs:
if old in para.text:
for run in para.runs:
run.text = run.text.replace(old, new)
doc.save("report.docx")
EOF
python - <<'EOF'
from docx import Document
def replace_in_paragraphs(paragraphs, old, new):
for para in paragraphs:
for run in para.runs:
if old in run.text:
run.text = run.text.replace(old, new)
doc = Document("report.docx")
old, new = "Draft", "Final"
replace_in_paragraphs(doc.paragraphs, old, new)
for table in doc.tables:
for row in table.rows:
for cell in row.cells:
replace_in_paragraphs(cell.paragraphs, old, new)
doc.save("report.docx")
EOF
python - <<'EOF'
from docx import Document
from docx.oxml.ns import qn
doc = Document("report.docx")
to_remove = []
for para in doc.paragraphs:
if "DELETE ME" in para.text:
to_remove.append(para._element)
for el in to_remove:
el.getparent().remove(el)
doc.save("report.docx")
EOF
python - <<'EOF'
from docx import Document
doc = Document("report.docx")
table = doc.add_table(rows=1, cols=2)
table.style = "Table Grid"
hdr = table.rows[0].cells
hdr[0].text = "Key"
hdr[1].text = "Value"
rows_data = [("Status", "Complete"), ("Owner", "Alice")]
for key, val in rows_data:
row = table.add_row().cells
row[0].text = key
row[1].text = val
doc.save("report.docx")
EOF
python - <<'EOF'
from docx import Document
doc = Document("report.docx")
doc.add_paragraph("Extra note added.")
doc.save("report_v2.docx") # original untouched
EOF
docx-read before editing so you know paragraph indices, style names, and table layout.para.text is read-only; mutations must go through run.text.para._element and call .getparent().remove(el) — there is no built-in remove_paragraph API.doc.save(same_path) overwrites in place. Use a different path to preserve the original.doc.tables only returns top-level tables; nested tables must be accessed via cell.tables.[!CAUTION] This is a write command — confirm with the user before executing. Overwriting
doc.save(original_path)is irreversible unless a backup exists.