為 Google 文件使用外掛程式增添功能
Google 文件是雲端式文件解決方案,提供即時協作功能和強大的工具,可用於撰寫、編輯及分享文件。
您可以透過外掛程式擴充 Google 文件,打造自訂工作流程改善項目、建立與第三方系統的連線,以及將文件與其他 Google Workspace 應用程式 (例如 Google 簡報) 整合。
您可以在 Google Workspace Marketplace 中查看其他人建立的 Google 文件外掛程式。
建議做法
以下是 Google Docs 擴充功能可提供的幾項功能:
- 您可以使用內建的 Apps Script 文件服務,在 Google 文件中閱讀、編輯、呈現及設定文字格式。這項服務還可讓您建立及修改 Google 文件中的表格、圖片、繪圖和方程式。
- 您可以使用標準 HTML 和 CSS 建立自訂選單,並定義多個自訂對話方塊和側欄介面。
- 您可以使用外掛程式觸發事件,在特定觸發事件發生時執行指定函式。
文件外掛程式是使用 Apps Script 建構而成。如要進一步瞭解如何使用 Apps Script 存取及管理 Google 文件,請參閱「擴充 Google 文件」一文。
文件結構
在 Google 文件中建立的文件具有樹狀內部結構 (類似 HTML 或 JSON),可定義文字、圖片、表格和其他元素的顯示位置和方式。Apps Script 文件服務定義了幾個類別 (例如 Paragraph
或 Table
),協助管理不同元素類型。
如要瞭解這些元素類別和規則,請參閱「文件結構」。
觸發條件
Apps Script 觸發事件可讓指令碼專案在符合特定條件時 (例如開啟文件或安裝外掛程式) 執行指定函式。
如要進一步瞭解可與 Google 文件外掛程式搭配使用的觸發條件,以及使用時的限制,請參閱外掛程式觸發條件。
開始使用
準備好查看程式碼時,請參閱我們的外掛程式範例,包括文件外掛程式快速入門,其中包含 Google 翻譯功能。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-16 (世界標準時間)。
[null,null,["上次更新時間:2025-02-16 (世界標準時間)。"],[[["Google Docs is a cloud-based document solution enabling real-time collaboration and offering robust tools for composing, editing, and sharing documents."],["Docs add-ons, built using Apps Script, extend functionality by enabling workflow customization, integration with third-party systems, and connectivity with other Google Workspace applications."],["Add-ons can manipulate document content, create custom interfaces, and automate tasks through triggers based on specific events."],["Google provides comprehensive documentation and resources, including code samples, to guide developers in building Docs add-ons."]]],["Google Docs is a cloud-based document solution that can be extended with add-ons via Apps Script. These add-ons can read, edit, visualize, and format text, create custom menus and dialogs, and integrate with other Google Workspace applications. Add-ons utilize Apps Script triggers to run functions when specific events occur. The documents' tree-like structure is managed through the Apps Script Document service. Resources are available, including add-on samples and a quickstart guide, to help begin developing.\n"]]