我們很高興宣布 GroupDocs.Editor for Python v26.5 已於 2026 年 5 月 正式發佈。這是首個透過 .NET 以自包含的 Python wheel(上傳至 PyPI)形式發布的 GroupDocs.Editor for Python。它將底層 .NET 函式庫的完整文件編輯功能帶到 Python:載入文件、將其轉換為乾淨、可編輯的 HTML/CSS、以程式方式或任何所見即所得編輯器編輯該標記,然後再儲存回原始格式——或轉換為其他格式——只需一次 pip install,且不需要 MS Office、OpenOffice 或額外的 .NET 執行環境。
本次發佈的新增功能
- [New feature] HTML 循環編輯 (EDTPY-1)
- [New feature] Pythonic API 介面,具自動映射的命名慣例 (EDTPY-2)
- [New feature] 跨 Word 處理、試算表、簡報、PDF、電子郵件、電子書與文字/標記格式的多格式支援 (EDTPY-3)
- [New feature] 透過 HTML 中介的格式轉換 (EDTPY-4)
- [New feature] 細粒度編輯(工作表/投影片/頁面範圍)以及分頁與語言中繼資料切換 (EDTPY-5)
- [New feature] 資源抽取(圖片、字型、CSS、音訊)與資料夾持久化 (EDTPY-6)
- [New feature] 透過
get_document_info()取得文件資訊 (EDTPY-7) - [New feature] 透過
editor.form_field_manager檢視與更新表單欄位 (EDTPY-8) - [New feature] 串流載入與 context‑manager 協定,以確保可預測的資源釋放 (EDTPY-9)
- [New feature] AI Agent 與 LLM 友好:內建
AGENTS.md、MCP 伺服器與機器可讀文件 (EDTPY-10)
公開 API 變更
整個 .NET API 皆以 Python 原生命名方式呈現。類別使用 PascalCase,方法與屬性使用 snake_case(自動映射到底層 .NET 的 PascalCase),列舉值使用 UPPER_SNAKE_CASE。
類別
Editor— 入口點;可透過路徑或串流開啟,提供edit()、save()、get_document_info()、form_field_managerEditableDocument— HTML/CSS 表示;提供get_content()、get_body_content()、get_embedded_html()、get_css_content()、save(),以及資源集合(images、fonts、css、audio、all_resources),並支援from_markup()/from_markup_and_resource_folder()/from_file()工廠方法FormFieldManager— 讀取與更新 Word 處理表單欄位License、Metered— 授權相關 API
選項
- 載入:
WordProcessingLoadOptions、SpreadsheetLoadOptions、PresentationLoadOptions、PdfLoadOptions - 編輯:
WordProcessingEditOptions、SpreadsheetEditOptions、PresentationEditOptions、PdfEditOptions、EbookEditOptions、EmailEditOptions、MarkdownEditOptions、TextEditOptions、XmlEditOptions、DelimitedTextEditOptions - 儲存:
WordProcessingSaveOptions、SpreadsheetSaveOptions、PresentationSaveOptions、PdfSaveOptions、HtmlSaveOptions、MhtmlSaveOptions、MarkdownSaveOptions、XpsSaveOptions、TextSaveOptions、EbookSaveOptions、EmailSaveOptions、DelimitedTextSaveOptions
列舉
WordProcessingFormats、SpreadsheetFormats、PresentationFormats、FixedLayoutFormats、EBookFormats、EmailFormats、TextualFormats、FontExtractionOptions、FontEmbeddingOptions
例外
PasswordRequiredException、IncorrectPasswordException、EncryptedException、InvalidFormatException
新功能
HTML 循環編輯
將任何支援的文件轉換為可編輯的 HTML/CSS,並在不失真的情況下儲存回原始格式——這是 GroupDocs.Editor 的核心工作流程。HTML 可透過程式碼或任何第三方所見即所得編輯器(如 CKEditor、TinyMCE)進行編輯。
Pythonic API 介面
整個 .NET API 皆以 Python 原生命名方式呈現。類別使用 PascalCase,方法與屬性使用 snake_case(自動映射到底層 .NET 的 PascalCase),列舉值使用 UPPER_SNAKE_CASE。
多格式支援
在 Word 處理、試算表、簡報、PDF、電子郵件、電子書與文字/標記格式之間提供統一的 API。
透過 HTML 的格式轉換
不再需要單獨的「convert」呼叫——只要以不同的 *SaveOptions 儲存 EditableDocument,即會自動透過 HTML 中介完成轉換。相同的輸入,輸出可自行決定。
細粒度編輯
編輯工作簿中的單一工作表、簡報中的單一投影片,或指定頁面範圍,並可切換分頁與語言中繼資料。
資源抽取
EditableDocument 會將抽取出的圖片、字型、CSS 與音訊以可迭代集合形式公開,且能將 HTML 與所有資源一起持久化至資料夾。
文件資訊檢視
在不進行完整編輯的情況下,讀取格式、頁數、大小與加密狀態等資訊。
表單欄位
透過 editor.form_field_manager 檢視與更新 Word 處理的表單欄位。
串流與 Context Manager
從任意二進位串流載入,並利用 context‑manager 協定確保原生文件句柄的可預測釋放。
AI Agent 與 LLM 友好
AGENTS.md內建於安裝的 wheel 中——Claude Code、Cursor 與 GitHub Copilot 可自動發現 API 介面、使用模式與故障排除提示。- MCP 伺服器——將您的 AI 工具指向
https://docs.groupdocs.com/mcp以即時查詢文件。 - 機器可讀文件 位於
https://docs.groupdocs.com/editor/python-net/llms-full.txt,供 RAG 與 LLM 上下文使用。
程式碼範例
from groupdocs.editor import Editor, EditableDocument
from groupdocs.editor.formats import WordProcessingFormats
from groupdocs.editor.options import WordProcessingSaveOptions
with Editor("document.docx") as editor:
editable = editor.edit() # document -> editable HTML
html = editable.get_embedded_html()
edited = EditableDocument.from_markup(html.replace("Hello", "Goodbye"))
editor.save(edited, "document.docx", WordProcessingSaveOptions(WordProcessingFormats.DOCX))
如何取得更新
PyPI
使用以下指令安裝或升級:
pip install groupdocs-editor-net
直接下載
從 GroupDocs.Editor for Python via .NET 26.5 頁面下載 wheel 檔案。
資源
- [Full Release Notes](https://docs.groupdocs.com/editor/python