脚注を表す要素。各 Footnote
は ListItem
または Paragraph
内に含まれ、脚注のコンテンツに対応する FootnoteSection
要素を持ちます。Footnote
自体に他の要素を含めることはできません。ドキュメント構造について詳しくは、Google ドキュメントの拡張ガイドをご覧ください。
Methods
メソッド | 戻り値の型 | 概要 |
---|---|---|
copy() | Footnote | 現在の要素の分離されたディープコピーを返します。 |
getAttributes() | Object | 要素の属性を取得します。 |
getFootnoteContents() | FootnoteSection | 脚注要素のコンテンツを取得します。 |
getNextSibling() | Element | 要素の次の兄弟要素を取得します。 |
getParent() | ContainerElement | 要素の親要素を取得します。 |
getPreviousSibling() | Element | 要素の前の兄弟要素を取得します。 |
getType() | ElementType | 要素の ElementType を取得します。 |
isAtDocumentEnd() | Boolean | 要素が Document の末尾にあるかどうかを判断します。 |
removeFromParent() | Footnote | 要素を親から削除します。 |
setAttributes(attributes) | Footnote | 要素の属性を設定します。 |
詳細なドキュメント
copy()
getAttributes()
要素の属性を取得します。
その結果、各有効な要素属性のプロパティを含むオブジェクトが返されます。各プロパティ名は、DocumentApp.Attribute
列挙型のアイテムに対応しています。
var body = DocumentApp.getActiveDocument().getBody(); // Append a styled paragraph. var par = body.appendParagraph('A bold, italicized paragraph.'); par.setBold(true); par.setItalic(true); // Retrieve the paragraph's attributes. var atts = par.getAttributes(); // Log the paragraph attributes. for (var att in atts) { Logger.log(att + ":" + atts[att]); }
リターン
Object
- 要素の属性。
承認
この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getFootnoteContents()
脚注要素のコンテンツを取得します。
リターン
FootnoteSection
- 脚注セクション
承認
この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getNextSibling()
getParent()
要素の親要素を取得します。
親要素には現在の要素が含まれます。
リターン
ContainerElement
- 親要素。
承認
この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
getPreviousSibling()
getType()
要素の ElementType
を取得します。
特定の要素の正確なタイプを特定するには、getType()
を使用します。
var body = DocumentApp.getActiveDocument().getBody(); // Obtain the first element in the document body. var firstChild = body.getChild(0); // Use getType() to determine the element's type. if (firstChild.getType() == DocumentApp.ElementType.PARAGRAPH) { Logger.log('The first element is a paragraph.'); } else { Logger.log('The first element is not a paragraph.'); }
リターン
ElementType
- 要素のタイプ。
承認
この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
isAtDocumentEnd()
removeFromParent()
要素を親から削除します。
var body = DocumentApp.getActiveDocument().getBody(); // Remove all images in the document body. var imgs = body.getImages(); for (var i = 0; i < imgs.length; i++) { imgs[i].removeFromParent(); }
リターン
Footnote
- 削除された要素。
承認
この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents
setAttributes(attributes)
要素の属性を設定します。
指定する 属性パラメータは、各プロパティ名が DocumentApp.Attribute
列挙型のアイテム、各プロパティ値が、適用される新しい値であるオブジェクトである必要があります。
var body = DocumentApp.getActiveDocument().getBody(); // Define a custom paragraph style. var style = {}; style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT; style[DocumentApp.Attribute.FONT_FAMILY] = 'Calibri'; style[DocumentApp.Attribute.FONT_SIZE] = 18; style[DocumentApp.Attribute.BOLD] = true; // Append a plain paragraph. var par = body.appendParagraph('A paragraph with custom style.'); // Apply the custom style. par.setAttributes(style);
パラメータ
名前 | 型 | 説明 |
---|---|---|
attributes | Object | 要素の属性。 |
リターン
Footnote
- 現在の要素。
承認
この方法を使用するスクリプトには、次の 1 つ以上のスコープによる承認が必要です。
-
https://www.googleapis.com/auth/documents.currentonly
-
https://www.googleapis.com/auth/documents