首頁 / Skills / 辦公與文件 / Word 文件產生 Word Document Builder
辦公與文件

Word 文件產生 Word Document Builder

AIBarsMITSkill 語言: 英文
授權已核對不含腳本中風險
演示真實執行紀錄 · claude-sonnet-5-5 · 2026年10月
Please create a Word document called atlas-status.docx: a short status report for a fictional project "Project Atlas" (an internal tool migration), for the steering group. It should have a title, a one-paragraph summary, a table of 4 milestones with owner, due date and status (make up plausible sample rows and mark them as sample), a bullet list of 3 risks, a header with the project name and a page number in the footer. Use A4. Then open the saved file and tell me what you verified.
Skill: word-document-builder

I created atlas-status.docx in the working folder and reopened it with python-docx to check the structure. I didn't check how it looks on the page.

What I confirmed from the reopened file

  • Page size: A4, 21.0 × 29.7 cm.
  • Title and headings: The title uses the Title style, followed by a "Prepared for the Steering Group" line. The three section headings (Summary, Milestones, Key Risks) use Heading 1.
  • Summary: One paragraph.
  • Table: A real Word table with a bold header row (Milestone, Owner, Due date, Status) and 4 milestone rows. The heading says "(sample data)" and a caption under the table says the rows are illustrative. Owners are placeholders ("A. Example" and so on), and the dates and statuses are made up.
  • Risks: 3 items in the List Bullet style.
  • Header and footer: The header reads "Project Atlas". The footer holds "Page" followed by a PAGE field.

What I didn't check

  • Page numbers: The number is a field, so it only displays when you open the file in Word. I confirmed the field exists, not what it shows.
  • Layout and page count: LibreOffice isn't installed here, so I couldn't convert to PDF. I can't say how the document looks or how many pages it runs to.

Before circulating: replace the sample milestone rows and the risk wording with real project content. The summary paragraph is generic text I wrote, since you gave no project details.

Files: the build script is scripts/build_docx.py and the check script is scripts/verify_docx.py, both in the working folder. My first attempt put the script in /tmp, which the sandbox blocked, so I used scripts/ instead.

Test run: a fictional status report built with python-docx 1.2.0 in a temporary folder. The run was allowed to write files and run python3 only. The model re-opened the file and checked page size, styles, the table, the bullets, the header and the page-number field. LibreOffice was not installed, so layout and page count were not checked. All content is sample.

它做什麼

撰寫並執行一個 Python 腳本來建立或修改 .docx,讓文件保持整潔、可繼續編輯。新文件用樣式產生真正的標題、清單與表格,而不是手動排版。修改既有檔案時,先輸出結構大綱,只改你要求的部分,保留範本的樣式、頁首與頁尾,並另存為新檔名。它也可以擷取文字與結構。頁碼與目錄是 Word 的欄位,所以它會插入欄位,並告訴你要在 Word 裡開啟後才會顯示。儲存後它會重新開啟檔案,回報檢查了什麼:頁面大小、標題順序、表格、項目符號、頁首與頁尾。

輸出

.docx 檔案、產生它的腳本、核對報告、沒有檢查的內容,以及需要你填寫的佔位內容。

適合什麼場景

想不手動開啟 Word,就依資料產生或修改報告、備忘錄、信函與範本文件的人。

說明與風險

中風險:純指令檔,本身沒有腳本,但它會撰寫並執行 Python,在你的工作目錄建立檔案,也可能建議在虛擬環境安裝 python-docx。它不會覆蓋你的原檔案,不建立巨集,也不連網抓取內容。已在暫存資料夾用範例內容試用一次:產生了一份狀態報告並重新開啟檢查結構;因為沒裝 LibreOffice,版面與頁碼沒有檢查。寄出前請在 Word 裡檢查檔案。AIBars 原創(MIT)。

SKILL.md 原文套件內共 2 個檔案