DocX Lossless Editing Toolkit
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md and install @user_c66b8218/docx007-skill.
About this skill
What Problem It Solves
A .docx file is not just a text container; it is a ZIP package of XML parts, media, styles, headers, footers, and revision data. Regenerating the whole document often breaks existing styles, numbering, sections, fields, and Chinese typography, while naive string replacement can miss the w:r and w:t run structure that Word relies on.
How It Works
The skill treats .docx as an unpackable XML package and follows an unpack → edit in place → repack workflow:
- Read: inspect the structure, outline, and preview with
docx_reader.pybefore changing anything. - Edit: choose creation, fill-in editing, or format application, then use scripts such as
docx_replace_text.py,docx_fill_placeholders.py, anddocx_add_paragraph.pyfor local changes. - Validate: run
docx_validate.pyand usedocx_reader.py --diff-againstto confirm only intended content changed. - Render: generate PDF and PNG with
docx_render.py, then visually check fonts, overflow, and layout.
It adds explicit CJK constraints, including UTF-8, w:rFonts w:eastAsia, font-size mapping, and GB/T 9704 official-document guidance. Headings also need w:outlineLvl, or they may disappear from the TOC or navigation pane.
Where It Fits
This is best for local edits, placeholder filling, and template restyling of existing .docx files, not for wholesale regeneration that discards the original package. Rendering depends on LibreOffice and poppler; if local CJK fonts are missing, the preview may substitute Noto, while the stored font name remains as authored.
Use Cases
- Update client names, dates, and amounts in an existing Word report while preserving styles, headers, and numbering.
- Apply a company template to monthly reports by adjusting styles and heading levels without regenerating the full document.
- Prepare Chinese official documents with GB/T 9704 guidance, including body fonts, heading fonts, and layout.
- After script-based DOCX changes, validate element order and render PNG previews to check font overflow.
Best For
- Documentation engineers maintaining Word templates, heading levels, and official-document layouts.
- Operations or product teams filling DOCX report placeholders at scale while preserving source formatting.
- Backend engineers modifying Word files via scripts and validating XML structure.
- Developers handling Chinese fonts, font sizes, and CJK typography.
Related Skills
Generates a fixed-structure A-share tech daily across five tracks, screening 24-hour news and selecting leader and growth stocks.
Convert teaching schedules from talent development plan PDFs into structured Excel files, with cross-page tables, merged cells, multi-semester course splitting, major metadata extraction, and batch output.
Turn post-meeting text into bilingual minutes, preserving structure and consistent terminology.
Interprets tender files, generates bid docs, and checks compliance via the Bailian API.