脚注を表す要素。各 Footnote
は ListItem
または Paragraph
内に含まれ、それぞれの FootnoteSection
要素に脚注の内容に対応しています。Footnote
自体に他の要素を含めることはできません。ドキュメント構造の詳細については、Google ドキュメントの拡張ガイドをご覧ください。
Methods
方法 | 戻り値の型 | 概要 |
---|---|---|
copy() | Footnote | 現在の要素から分離されたディープコピーを返します。 |
getAttributes() | Object | 要素の属性を取得します。 |
getFootnoteContents() | FootnoteSection | footnote 要素の内容を取得します。 |
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()
footnote 要素の内容を取得します。
戻る
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