Class Tab

Tab

Google ドキュメント ドキュメント内のタブ。

// Get all of the first-level tabs (tabs that are not nested within a parent // tab) in the document. // TODO(developer): Replace the ID with your own. const tabs = DocumentApp.openById('123abc').getTabs();  // Get a specific tab based on the tab ID. // TODO(developer): Replace the IDs with your own. const tab = DocumentApp.openById('123abc').getTab('123abc');

メソッド

メソッド戻り値の型概要
asDocumentTab()DocumentTabタブの内容を DocumentTab として取得します。
getChildTabs()Tab[]このタブ内にネストされた子タブを取得します。
getId()Stringタブの ID を取得します。
getIndex()Integer親内のタブの 0 ベースのインデックスを取得します。
getTitle()Stringタブのタイトルを取得します。
getType()TabTypeタブのタイプを取得します。

詳細なドキュメント

asDocumentTab()

タブの内容を DocumentTab として取得します。

戻る

DocumentTab - タブ(DocumentTab)。


getChildTabs()

このタブ内にネストされた子タブを取得します。

戻る

Tab[] - このタブ内にネストされた子タブ。

承認

このメソッドを使用するスクリプトには、次のスコープの 1 つ以上による承認が必要です。

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getId()

タブの ID を取得します。

戻る

String - タブの ID。

承認

このメソッドを使用するスクリプトには、次のスコープの 1 つ以上による承認が必要です。

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getIndex()

親内のタブの 0 ベースのインデックスを取得します。

戻る

Integer - 親内のタブのインデックス。

承認

このメソッドを使用するスクリプトには、次のスコープの 1 つ以上による承認が必要です。

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getTitle()

タブのタイトルを取得します。

戻る

String - タブのタイトル。

承認

このメソッドを使用するスクリプトには、次のスコープの 1 つ以上による承認が必要です。

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getType()

タブのタイプを取得します。

このメソッドを使用して、この Tab のコンテンツ タイプを特定してから、asDocumentTab() を使用してより具体的なタイプにキャストします。

const tab = DocumentApp.getActiveDocument().getActiveTab(); // Use getType() to determine the tab's type before casting. if (tab.getType() === DocumentApp.TabType.DOCUMENT_TAB) {   // It's a document tab, write some text to it.   tab.asDocumentTab().setText('Hello World!'); } else {   // There are currently no types other than DOCUMENT_TAB. }

戻る

TabType - タブのタイプ。

承認

このメソッドを使用するスクリプトには、次のスコープの 1 つ以上による承認が必要です。

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents