使用插件扩展 Google 文档
Google 文档是一款基于云的文档解决方案,提供实时协作功能,以及强大的文档撰写、编辑和共享工具。
您可以使用插件扩展 Google 文档,从而构建自定义工作流程改进、建立与第三方系统的连接,以及将文档与其他 Google Workspace 应用(例如 Google 幻灯片)集成。
您可以在 Google Workspace Marketplace 中查看其他人构建的 Google 文档插件。
可以采取的措施
以下是您可以使用扩展 Google 文档功能的插件执行的一些操作:
- 您可以使用内置的 Apps 脚本文档服务在 Google 文档中阅读、编辑、直观呈现和设置文本格式。借助该服务,您还可以创建和修改 Google 文档中显示的表格、图片、绘图和公式。
- 您可以使用标准 HTML 和 CSS 创建自定义菜单,并定义多个自定义对话框和边栏界面。
- 您可以使用插件触发器在发生特定触发事件时运行指定函数。
Google 文档插件是使用 Apps 脚本构建的。如需详细了解如何使用 Apps 脚本访问和管理 Google 文档,请参阅扩展 Google 文档。
文档结构
在 Google 文档中创建的文档具有树状的内部结构(类似于 HTML 或 JSON),用于定义文本、图片、表格和其他元素的显示位置和方式。Apps Script 文档服务定义了多个类(例如 Paragraph
或 Table
),以帮助管理不同的元素类型。
如需了解这些元素类以及用于管理其排列方式的规则,请参阅文档结构。
触发器
借助 Apps 脚本触发器,脚本项目可以在满足特定条件(例如打开文档或安装插件)时执行指定函数。
如需详细了解哪些触发器可与 Google 文档插件搭配使用,以及使用这些触发器时受到哪些限制,请参阅插件触发器。
使用入门
当您准备好查看一些代码时,请查看我们的插件示例,包括包含 Google 翻译的 Google 文档插件快速入门。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-16。
[null,null,["最后更新时间 (UTC):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"]]