プレゼンテーションの更新のライフサイクル
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Presentation オブジェクトのライフサイクルには、開く、編集する、保存するという 3 つの主なフェーズがあります。
プレゼンテーションを開く
Slides サービスを使用する場合、最初の手順はプレゼンテーションを読み込むことです。SlidesApp.openById() や SlidesApp.getActivePresentation() などのメソッドは既存のスライド プレゼンテーションを読み込みますが、SlidesApp.create() は新しいプレゼンテーションを作成します。これらのメソッドは、読み込まれたプレゼンテーションを表す Presentation オブジェクトを返します。
プレゼンテーションを開くと、共同編集者からの更新はそれ以上受信されなくなります。通常、プレゼンテーションは、ドライブに保存されている最新バージョンで開かれます。ただし、スクリプトがプレゼンテーションにコンテナ バインドされている場合、そのプレゼンテーションは、付随するスライド エディタと同じバージョンで読み込まれます。
プレゼンテーションの変更
プレゼンテーションが開かれると、スクリプトで読み取りと変更を行うことができます。スクリプトによってプレゼンテーションに加えられた変更は、スクリプトの実行中、後続の読み取りと変更に反映されます。
変更を保存しています
プレゼンテーションに変更を加えると、スクリプトの実行が完了したとき、または Presentation.saveAndClose() が呼び出されたときに、変更がすべて一度に保存されます。変更が保存されると、変更は共同編集者によって行われたかのように、ユーザーのエディタに非同期で反映されます。
Presentation.saveAndClose()
を使用してプレゼンテーションを閉じると、プレゼンテーションの読み込みメソッドのいずれかを使用して、編集用に再度開くことができます。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eThe Slides service allows you to open existing or create new Google Slides presentations for manipulation within Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eScripts can modify presentations, with changes reflected immediately within the script but saved and propagated to the editor upon script completion or explicit save.\u003c/p\u003e\n"],["\u003cp\u003eSaving changes to a presentation is done automatically at the end of script execution or manually using \u003ccode\u003ePresentation.saveAndClose()\u003c/code\u003e, after which the presentation can be reopened.\u003c/p\u003e\n"]]],[],null,["# Life cycle of a presentation update\n\nThere are three main phases in the life cycle of a\n[Presentation](/apps-script/reference/slides/presentation) object: opening,\nediting, and saving.\n\nOpening a presentation\n----------------------\n\nWhen using the Slides Service, the first step is to load a presentation. Methods\nlike [SlidesApp.openById()](/apps-script/reference/slides/slides-app#openbyidid)\nand [SlidesApp.getActivePresentation()](/apps-script/reference/slides/slides-app#getactivepresentation)\nload an existing Slides presentation, while\n[SlidesApp.create()](/apps-script/reference/slides/slides-app#createname)\ncreates a new presentation. These methods return a\n[Presentation](/apps-script/reference/slides/presentation) object that\nrepresents the loaded presentation.\n\nOnce a presentation is open, it does not receive any further updates from\ncollaborators. Presentations are usually opened at their latest version that has\nbeen saved in Drive. However, if a script is container-bound to a presentation,\nthat presentation will be loaded at the same version as the accompanying Slides\neditor.\n\nModifying a presentation\n------------------------\n\nOnce a presentation is open, a script can read and modify it. Any changes that\nthe script makes to the presentation are reflected in subsequent reads and\nmodifications for the duration of the script execution.\n\nSaving changes\n--------------\n\nAfter making changes to a presentation, the changes are saved all at once\nwhen the script execution completes, or when [Presentation.saveAndClose()](/apps-script/reference/slides/presentation#saveandclose) is\ncalled. After changes are saved, they propagate asynchronously to the\nuser's editor, as if the changes were made by a collaborator.\n\nAfter a presentation is closed using `Presentation.saveAndClose()`, it can be\nreopened for editing using one of the presentation loading methods."]]