Class Tab

タブ

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

// Get all of the first-level tabs (tabs that are not nested within a parent tab) in the
// document.
var tabs = DocumentApp.openById('abc123456').getTabs();

// Get a specific tab based on the tab ID.
var tab = DocumentApp.openById('abc123456').getTab('t.0');

メソッド

メソッド戻り値の型概要
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() を使用して特定の型に絞り込むことができます。

var tab = DocumentApp.getActiveDocument().getTab('t.0');
// 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