在 Google 幻灯片演示文稿中显示进度条
编码级别:中级
时长:15 分钟
项目类型:编辑器插件
目标
- 了解该解决方案的用途。
- 了解 Apps Script 服务在解决方案中的作用。
- 设置脚本。
- 运行脚本。
关于此解决方案
您可以使用此解决方案在演示文稿的幻灯片底部添加进度条。

运作方式
该脚本会计算演示文稿中有多少张幻灯片,并在每张幻灯片的底部添加一个矩形形状。该脚本会增加每个矩形形状的宽度,以便在幻灯片中显示进度。
Apps 脚本服务
此解决方案使用以下服务:
- 幻灯片服务 - 获取演示文稿的幻灯片,并为每个幻灯片添加一个矩形形状。
前提条件
如需使用此示例,您需要满足以下前提条件:
- Google 账号(Google Workspace 账号可能需要管理员批准)。
- 一个能够访问互联网的网络浏览器。
设置脚本
- 点击以下按钮,即可复制进度条 Google 幻灯片演示文稿。此解决方案的 Apps 脚本项目已附加到演示文稿中。
复制
- 在演示文稿中,依次点击扩展程序
>
进度条 >
显示进度条。
根据提示为脚本授权。如果 OAuth 意见征求界面显示此应用未经验证警告,请依次选择高级 >
前往 {Project Name}(不安全)以继续操作。
再次依次点击扩展程序 >
进度条 > 显示进度条。
如需移除进度条,请依次点击扩展程序
>
进度条 > 隐藏进度条。
查看代码
如需查看此解决方案的 Apps 脚本代码,请点击下方的查看源代码:
贡献者
此示例由 Google 维护,并由 Google 开发者专家提供帮助。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-22。
[null,null,["最后更新时间 (UTC):2024-12-22。"],[[["This Google Apps Script solution adds a progress bar to the bottom of Google Slides presentations to visually track progress through the slides."],["The script uses the Slides service to calculate the number of slides, add a rectangle shape to each slide, and dynamically adjust the rectangle's width to represent progress."],["Users can easily install the script by making a copy of the provided presentation and authorizing the script to access their Google Slides."],["The progress bar can be shown or hidden using the \"Progress bar\" menu found under \"Extensions\" in Google Slides after installation."],["Developers can review and modify the source code, which is publicly available on GitHub, for customization or further development."]]],["This solution adds a progress bar to Google Slides presentations using Apps Script. The script calculates the total slides and adds a rectangle to the bottom of each slide, increasing the rectangle's width to visually represent progress. Users copy a sample presentation, authorize the script, and then run it to create or remove the progress bars via the \"Extensions\" menu. It utilizes the Slides service to manipulate slides and shapes, adding and deleting these elements.\n"]]