本記事では、Google Apps ScriptでGoogleドキュメントに対して使うことができるDocumentAppという処理の一覧表を用意しました。Googleの公式ドキュメントは英語なので、分かりづらいところもありますので、みなさんがそこで挫折しないように日本語で内容が把握できるようにします。
まだすべてのメソッドで日本語での使い方が解説できているわけではありませんが、最終的にはすべての使い方を日本語で解説するページを用意していきます。
日本語化されている記事の見分け方は、簡単な説明列で日本語が記載されているものについては日本語記事が用意できています。メソッド名をクリックすることで対象の記事を閲覧することができます。
日本語の記事が出来上がっていないメソッドについてはGoogleから提供されている公式ドキュメント(英語)へのリンクとなっています。
DocumentAppの概要
DocumentAppとは、Google Apps ScriptでGoogleドキュメントに対する操作を行うコードですが、DocumentAppに用意されているメソッドでは、次のような操作を行うことができます。
- ドキュメントファイルの作成
- アクセス権限の編集
- ドキュメントファイルの修正
クラス名一覧
※クリックすると対象場所にジャンプします
インターフェイス
| Element |
列挙型一覧
| VerticalAlignment | TextAlignment | PositionedLayout |
| ParagraphHeading | HorizontalAlignment | GlyphType |
| FontFamily(非推奨) | ElementType | Attribute |
※クリックすると対象場所にジャンプします
クラス別メソッド名一覧
Class Body
Bodyクラスはドキュメントボディを制御するクラスで、ドキュメントボディはListItem、Paragraph、Table、TableOfContentsによって構成されています。ドキュメント構造についての詳しい情報は、ドキュメント構造(未実装)をご確認下さい。
概ねヘッダー、フッター等を除くドキュメントの内容がドキュメントボディ部分となります。
Class Body
| メソッド名 | 返り値 | 簡単な説明 |
| appendHorizontalRule | HorizontalRule | Creates and appends a new HorizontalRule. |
| appendImage | InlineImage | Creates and appends a new InlineImage from the specified image blob. |
| appendListItem | ListItem | Appends the given ListItem. |
| appendPageBreak | PageBreak | Creates and appends a new PageBreak. |
| appendParagraph | Paragraph | Appends the given Paragraph. |
| appendTable | Table | Creates and appends a new Table. |
| clear | Body | Clears the contents of the element. |
| copy | Body | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getHeadingAttributes | Object | Retrieves the set of attributes for the provided ParagraphHeading. |
| getImages | InlineImage[] | Retrieves all the InlineImages contained in the section. |
| getListItems | ListItem[] | Retrieves all the ListItems contained in the section. |
| getMarginBottom | Number | Retrieves the bottom margin, in points. |
| getMarginLeft | Number | Retrieves the left margin, in points. |
| getMarginRight | Number | Retrieves the right margin. |
| getMarginTop | Number | Retrieves the top margin. |
| getNumChildren | Integer | Retrieves the number of children. |
| getPageHeight | Number | Retrieves the page height, in points. |
| getPageWidth | Number | Retrieves the page width, in points. |
| getParagraphs | Paragraph[] | Retrieves all the Paragraphs contained in the section (including ListItems). |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getTables | Table[] | Retrieves all the Tables contained in the section. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertHorizontalRule | HorizontalRule | Creates and inserts a new HorizontalRule at the specified index. |
| insertImage | InlineImage | Creates and inserts an InlineImage from the specified image blob, at the specified index. |
| insertListItem | ListItem | Inserts the given ListItem at the specified index. |
| insertPageBreak | PageBreak | Creates and inserts a new PageBreak at the specified index. |
| insertParagraph | Paragraph | Inserts the given Paragraph at the specified index. |
| insertTable | Table | Creates and inserts a new Table at the specified index. |
| removeChild | Body | Removes the specified child element. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | Body | Sets the element’s attributes. |
| setHeadingAttributes | Body | Sets the attributes for the provided ParagraphHeading. |
| setMarginBottom | Body | Sets the bottom margin, in points. |
| setMarginLeft | Body | Sets the left margin, in points. |
| setMarginRight | Body | Sets the right margin, in points. |
| setMarginTop | Body | Sets the top margin. |
| setPageHeight | Body | Sets the page height, in points. |
| setPageWidth | Body | Sets the page width, in points. |
| setText | Body | Sets the contents as plain text. |
| setTextAlignment | Body | Sets the text alignment. |
Class Bookmark
| メソッド名 | タイプ | 簡単な説明 |
| getId | String | ブックマークのIDを取得 |
| getPosition | Position | ブックマークの位置を取得 |
| remove | void | ブックマークを削除 |
Class ContainerElement
| メソッド名 | 返り値 | 簡単な説明 |
| asBody | Body | Returns the current element as a Body. |
| asEquation | Equation | Returns the current element as a Equation. |
| asFooterSection | FooterSection | Returns the current element as a FooterSection. |
| asFootnoteSection | FootnoteSection | Returns the current element as a FootnoteSection. |
| asHeaderSection | HeaderSection | Returns the current element as a HeaderSection. |
| asListItem | ListItem | Returns the current element as a ListItem. |
| asParagraph | Paragraph | Returns the current element as a Paragraph. |
| asTable | Table | Returns the current element as a Table. |
| asTableCell | TableCell | Returns the current element as a TableCell. |
| asTableOfContents | TableOfContents | Returns the current element as a TableOfContents. |
| asTableRow | TableRow | Returns the current element as a TableRow. |
| clear | ContainerElement | Clears the contents of the element. |
| copy | ContainerElement | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | ContainerElement | Merges the element with the preceding sibling of the same type. |
| removeFromParent | ContainerElement | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | ContainerElement | Sets the element’s attributes. |
| setLinkUrl | ContainerElement | Sets the link url. |
| setTextAlignment | ContainerElement | Sets the text alignment. |
Class DocumentApp
| メソッド名 | 返り値 | 簡単な説明 |
| addBookmark | Bookmark | Adds a Bookmark at the given Position. |
| addEditor | Document | Adds the given user to the list of editors for the Document. |
| addEditors | Document | Adds the given array of users to the list of editors for the Document. |
| addFooter | FooterSection | Adds a document footer section, if none exists. |
| addHeader | HeaderSection | Adds a document header section, if none exists. |
| addNamedRange | NamedRange | Adds a new NamedRange, which is a Range that has a name and ID to allow later retrieval. |
| addViewer | Document | Adds the given user to the list of viewers for the Document. |
| addViewers | Document | Adds the given array of users to the list of viewers for the Document. |
| getAs | Blob | Retrieves the current Document contents as a blob of the specified type. |
| getBlob | Blob | Retrieves the current Document contents as a blob. |
| getBody | Body | Retrieves the active document’s Body. |
| getBookmark | Bookmark | Gets the Bookmark with the given ID. |
| getBookmarks | Bookmark[] | Gets all Bookmark objects in the document. |
| getCursor | Position | Gets the user’s cursor in the active document. |
| getEditors | User[] | Gets the list of editors for this Document. |
| getFooter | FooterSection | Retrieves the document’s footer section, if one exists. |
| getFootnotes | Footnote[] | Retrieves all the Footnote elements in the document body. |
| getHeader | HeaderSection | Retrieves the document’s header section, if one exists. |
| getId | String | Retrieves the document’s unique identifier. |
| getLanguage | String | Gets the document’s language code. |
| getName | String | Retrieves the title of the document. |
| getNamedRangeById | NamedRange | Gets the NamedRange with the given ID. |
| getNamedRanges | NamedRange[] | Gets all NamedRange objects in the document. |
| getSelection | Range | Gets the user’s selection in the active document. |
| getSupportedLanguageCodes | String[] | Gets all language codes that are supported in Google Docs files. |
| getUrl | String | Retrieves the URL to access the current document. |
| getViewers | User[] | Gets the list of viewers and commenters for this Document. |
| newPosition | Position | Creates a new Position, which is a reference to a location in the document, relative to a specific element. |
| newRange | RangeBuilder | Creates a builder used to construct Range objects from document elements. |
| removeEditor | Document | Removes the given user from the list of editors for the Document. |
| removeViewer | Document | Removes the given user from the list of viewers and commenters for the Document. |
| saveAndClose | void | Saves the current Document. |
| setCursor | Document | Sets the user’s cursor in the active document, given a Position. |
| setLanguage | Document | Sets the document’s language code. |
| setName | Document | Sets the document title. |
| setSelection | Document | Sets the user’s selection in the active document, given a Range. |
Class Equation
| メソッド名 | 返り値 | 簡単な説明 |
| clear | Equation | Clears the contents of the element. |
| copy | Equation | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | Equation | Merges the element with the preceding sibling of the same type. |
| removeFromParent | Equation | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | Equation | Sets the element’s attributes. |
| setLinkUrl | Equation | Sets the link url. |
| setTextAlignment | Equation | Sets the text alignment. |
Class EquationFunction
| メソッド名 | 返り値 | 簡単な説明 |
| clear | EquationFunction | Clears the contents of the element. |
| copy | EquationFunction | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getCode | String | Retrieves the code corresponding to the equation function. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | EquationFunction | Merges the element with the preceding sibling of the same type. |
| removeFromParent | EquationFunction | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | EquationFunction | Sets the element’s attributes. |
| setLinkUrl | EquationFunction | Sets the link url. |
| setTextAlignment | EquationFunction | Sets the text alignment. |
Class EquationFunctionArgumentSeparator
| メソッド名 | 返り値 | 簡単な説明 |
| copy | EquationFunctionArgumentSeparator | Returns a detached, deep copy of the current element. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | EquationFunctionArgumentSeparator | Merges the element with the preceding sibling of the same type. |
| removeFromParent | EquationFunctionArgumentSeparator | Removes the element from its parent. |
| setAttributes | EquationFunctionArgumentSeparator | Sets the element’s attributes. |
Class EquationSymbol
| メソッド名 | 返り値 | 簡単な説明 |
| copy | EquationSymbol | Returns a detached, deep copy of the current element. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getCode | String | Retrieves the code corresponding to the equation symbol. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | EquationSymbol | Merges the element with the preceding sibling of the same type. |
| removeFromParent | EquationSymbol | Removes the element from its parent. |
| setAttributes | EquationSymbol | Sets the element’s attributes. |
Class FooterSection
| メソッド名 | 返り値 | 簡単な説明 |
| appendHorizontalRule | HorizontalRule | Creates and appends a new HorizontalRule. |
| appendImage | InlineImage | Creates and appends a new InlineImage from the specified image blob. |
| appendListItem | ListItem | Appends the given ListItem. |
| appendParagraph | Paragraph | Appends the given Paragraph. |
| appendTable | Table | Creates and appends a new Table. |
| clear | FooterSection | Clears the contents of the element. |
| copy | FooterSection | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getImages | InlineImage[] | Retrieves all the InlineImages contained in the section. |
| getListItems | ListItem[] | Retrieves all the ListItems contained in the section. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParagraphs | Paragraph[] | Retrieves all the Paragraphs contained in the section (including ListItems). |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getTables | Table[] | Retrieves all the Tables contained in the section. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertHorizontalRule | HorizontalRule | Creates and inserts a new HorizontalRule at the specified index. |
| insertImage | InlineImage | Creates and inserts an InlineImage from the specified image blob, at the specified index. |
| insertListItem | ListItem | Inserts the given ListItem at the specified index. |
| insertParagraph | Paragraph | Inserts the given Paragraph at the specified index. |
| insertTable | Table | Creates and inserts a new Table at the specified index. |
| removeChild | FooterSection | Removes the specified child element. |
| removeFromParent | FooterSection | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | FooterSection | Sets the element’s attributes. |
| setText | FooterSection | Sets the contents as plain text. |
| setTextAlignment | FooterSection | Sets the text alignment. |
Class Footnote
| メソッド名 | 返り値 | 簡単な説明 |
| copy | Footnote | Returns a detached, deep copy of the current element. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getFootnoteContents | FootnoteSection | Retrieves the contents of the footnote element. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| removeFromParent | Footnote | Removes the element from its parent. |
| setAttributes | Footnote | Sets the element’s attributes. |
Class FootnoteSection
| メソッド名 | 返り値 | 簡単な説明 |
| appendParagraph | Paragraph | Appends the given Paragraph. |
| clear | FootnoteSection | Clears the contents of the element. |
| copy | FootnoteSection | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParagraphs | Paragraph[] | Retrieves all the Paragraphs contained in the section (including ListItems). |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertParagraph | Paragraph | Inserts the given Paragraph at the specified index. |
| removeChild | FootnoteSection | Removes the specified child element. |
| removeFromParent | FootnoteSection | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | FootnoteSection | Sets the element’s attributes. |
| setText | FootnoteSection | Sets the contents as plain text. |
| setTextAlignment | FootnoteSection | Sets the text alignment. |
Class HeaderSection
| メソッド名 | 返り値 | 簡単な説明 |
| appendHorizontalRule | HorizontalRule | Creates and appends a new HorizontalRule. |
| appendImage | InlineImage | Creates and appends a new InlineImage from the specified image blob. |
| appendListItem | ListItem | Appends the given ListItem. |
| appendParagraph | Paragraph | Appends the given Paragraph. |
| appendTable | Table | Creates and appends a new Table. |
| clear | HeaderSection | Clears the contents of the element. |
| copy | HeaderSection | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getImages | InlineImage[] | Retrieves all the InlineImages contained in the section. |
| getListItems | ListItem[] | Retrieves all the ListItems contained in the section. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParagraphs | Paragraph[] | Retrieves all the Paragraphs contained in the section (including ListItems). |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getTables | Table[] | Retrieves all the Tables contained in the section. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertHorizontalRule | HorizontalRule | Creates and inserts a new HorizontalRule at the specified index. |
| insertImage | InlineImage | Creates and inserts an InlineImage from the specified image blob, at the specified index. |
| insertListItem | ListItem | Inserts the given ListItem at the specified index. |
| insertParagraph | Paragraph | Inserts the given Paragraph at the specified index. |
| insertTable | Table | Creates and inserts a new Table at the specified index. |
| removeChild | HeaderSection | Removes the specified child element. |
| removeFromParent | HeaderSection | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | HeaderSection | Sets the element’s attributes. |
| setText | HeaderSection | Sets the contents as plain text. |
| setTextAlignment | HeaderSection | Sets the text alignment. |
Class HorizontalRule
| メソッド名 | 返り値 | 簡単な説明 |
| copy | HorizontalRule | Returns a detached, deep copy of the current element. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| removeFromParent | HorizontalRule | Removes the element from its parent. |
| setAttributes | HorizontalRule | Sets the element’s attributes. |
Class InlineDrawing
| メソッド名 | 返り値 | 簡単な説明 |
| copy | InlineDrawing | Returns a detached, deep copy of the current element. |
| getAltDescription | String | Returns the drawing’s alternate description. |
| getAltTitle | String | Returns the drawing’s alternate title. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | InlineDrawing | Merges the element with the preceding sibling of the same type. |
| removeFromParent | InlineDrawing | Removes the element from its parent. |
| setAltDescription | InlineDrawing | Sets the drawing’s alternate description. |
| setAltTitle | InlineDrawing | Sets the drawing’s alternate title. |
| setAttributes | InlineDrawing | Sets the element’s attributes. |
Class InlineImage
| メソッド名 | 返り値 | 簡単な説明 |
| copy | InlineImage | Returns a detached, deep copy of the current element. |
| getAltDescription | String | Returns the image’s alternate description. |
| getAltTitle | String | Returns the image’s alternate title. |
| getAs | Blob | Return the data inside this object as a blob converted to the specified content type. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getBlob | Blob | Return the data inside this object as a blob. |
| getHeight | Integer | Retrieves the image’s height, in pixels. |
| getLinkUrl | String | Retrieves the link URL. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| getWidth | Integer | Retrieves the image’s width, in pixels. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | InlineImage | Merges the element with the preceding sibling of the same type. |
| removeFromParent | InlineImage | Removes the element from its parent. |
| setAltDescription | InlineImage | Sets the image’s alternate description. |
| setAltTitle | InlineImage | Sets the image’s alternate title. |
| setAttributes | InlineImage | Sets the element’s attributes. |
| setHeight | InlineImage | Sets the image’s height, in pixels. |
| setLinkUrl | InlineImage | Sets the link URL. |
| setWidth | InlineImage | Sets the image’s width, in pixels. |
Class ListItem
| メソッド名 | 返り値 | 簡単な説明 |
| addPositionedImage | PositionedImage | Creates and inserts a new PositionedImage from the specified image blob. |
| appendHorizontalRule | HorizontalRule | Creates and appends a new HorizontalRule. |
| appendInlineImage | InlineImage | Creates and appends a new InlineImage from the specified image blob. |
| appendPageBreak | PageBreak | Creates and appends a new PageBreak. |
| appendText | Text | Creates and appends a new Text element with the specified contents. |
| clear | ListItem | Clears the contents of the element. |
| copy | ListItem | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAlignment | HorizontalAlignment | Retrieves the HorizontalAlignment. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getGlyphType | GlyphType | Retrieves the list item’s GlyphType. |
| getHeading | ParagraphHeading | Retrieves the ParagraphHeading. |
| getIndentEnd | Number | Retrieves the end indentation, in points. |
| getIndentFirstLine | Number | Retrieves the first line indentation, in points. |
| getIndentStart | Number | Retrieves the start indentation. |
| getLineSpacing | Number | Retrieves the line spacing, in points. |
| getLinkUrl | String | Retrieves the link url. |
| getListId | String | Retrieves the list ID. |
| getNestingLevel | Integer | Retrieves the list item’s nesting level. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPositionedImage | PositionedImage | Gets a PositionedImage by the image’s ID. |
| getPositionedImages | PositionedImage[] | Gets all PositionedImage objects anchored to the paragraph. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getSpacingAfter | Number | Retrieves the spacing after the element, in points. |
| getSpacingBefore | Number | Retrieves the spacing before the element, in points. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertHorizontalRule | HorizontalRule | Creates and inserts a HorizontalRule at the specified index. |
| insertInlineImage | InlineImage | Creates and inserts a new InlineImage from the specified image blob, at the specified index. |
| insertPageBreak | PageBreak | Creates and inserts a new PageBreak at the specified index. |
| insertText | Text | Creates and inserts a new text element at the specified index. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| isLeftToRight | Boolean | Retrieves the left-to-right setting. |
| merge | ListItem | Merges the element with the preceding sibling of the same type. |
| removeChild | ListItem | Removes the specified child element. |
| removeFromParent | ListItem | Removes the element from its parent. |
| removePositionedImage | Boolean | Removes a PositionedImage by the image’s ID. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAlignment | ListItem | Sets the HorizontalAlignment. |
| setAttributes | ListItem | Sets the element’s attributes. |
| setGlyphType | ListItem | Sets the list item’s GlyphType. |
| setHeading | ListItem | Sets the ParagraphHeading. |
| setIndentEnd | ListItem | Sets the end indentation, in points. |
| setIndentFirstLine | ListItem | Sets the first line indentation, in points. |
| setIndentStart | ListItem | Sets the start indentation, in points. |
| setLeftToRight | ListItem | Sets the left-to-right setting. |
| setLineSpacing | ListItem | Sets the line spacing, as a quantity indicating the number of lines to use for spacing. |
| setLinkUrl | ListItem | Sets the link url. |
| setListId | ListItem | Sets the list ID. |
| setNestingLevel | ListItem | Sets the list item’s nesting level. |
| setSpacingAfter | ListItem | Sets the spacing after the element, in points. |
| setSpacingBefore | ListItem | Sets the spacing before the element, in points. |
| setText | void | Sets the contents of the list item as text. |
| setTextAlignment | ListItem | Sets the text alignment. |
Class NamedRange
| メソッド名 | 返り値 | 簡単な説明 |
| getId | String | Gets the ID of this NamedRange. |
| getName | String | Gets the name of this NamedRange. |
| getRange | Range | Gets the range of elements associated with this NamedRange. |
| remove | void | Removes this NamedRange from the document. |
Class PageBreak
| メソッド名 | 返り値 | 簡単な説明 |
| copy | PageBreak | Returns a detached, deep copy of the current element. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| removeFromParent | PageBreak | Removes the element from its parent. |
| setAttributes | PageBreak | Sets the element’s attributes. |
Class Paragraph
| メソッド名 | 返り値 | 簡単な説明 |
| addPositionedImage | PositionedImage | Creates and inserts a new PositionedImage from the specified image blob. |
| appendHorizontalRule | HorizontalRule | Creates and appends a new HorizontalRule. |
| appendInlineImage | InlineImage | Creates and appends a new InlineImage from the specified image blob. |
| appendPageBreak | PageBreak | Creates and appends a new PageBreak. |
| appendText | Text | Creates and appends a new Text element with the specified contents. |
| clear | Paragraph | Clears the contents of the element. |
| copy | Paragraph | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAlignment | HorizontalAlignment | Retrieves the HorizontalAlignment. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getHeading | ParagraphHeading | Retrieves the ParagraphHeading. |
| getIndentEnd | Number | Retrieves the end indentation, in points. |
| getIndentFirstLine | Number | Retrieves the first line indentation, in points. |
| getIndentStart | Number | Retrieves the start indentation. |
| getLineSpacing | Number | Retrieves the line spacing, in points. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPositionedImage | PositionedImage | Gets a PositionedImage by the image’s ID. |
| getPositionedImages | PositionedImage[] | Gets all PositionedImage objects anchored to the paragraph. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getSpacingAfter | Number | Retrieves the spacing after the element, in points. |
| getSpacingBefore | Number | Retrieves the spacing before the element, in points. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertHorizontalRule | HorizontalRule | Creates and inserts a HorizontalRule at the specified index. |
| insertInlineImage | InlineImage | Creates and inserts a new InlineImage from the specified image blob, at the specified index. |
| insertPageBreak | PageBreak | Creates and inserts a new PageBreak at the specified index. |
| insertText | Text | Creates and inserts a new text element at the specified index. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| isLeftToRight | Boolean | Retrieves the left-to-right setting. |
| merge | Paragraph | Merges the element with the preceding sibling of the same type. |
| removeChild | Paragraph | Removes the specified child element. |
| removeFromParent | Paragraph | Removes the element from its parent. |
| removePositionedImage | Boolean | Removes a PositionedImage by the image’s ID. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAlignment | Paragraph | Sets the HorizontalAlignment. |
| setAttributes | Paragraph | Sets the element’s attributes. |
| setHeading | Paragraph | Sets the ParagraphHeading. |
| setIndentEnd | Paragraph | Sets the end indentation, in points. |
| setIndentFirstLine | Paragraph | Sets the first line indentation, in points. |
| setIndentStart | Paragraph | Sets the start indentation, in points. |
| setLeftToRight | Paragraph | Sets the left-to-right setting. |
| setLineSpacing | Paragraph | Sets the line spacing, as a quantity indicating the number of lines to use for spacing. |
| setLinkUrl | Paragraph | Sets the link url. |
| setSpacingAfter | Paragraph | Sets the spacing after the element, in points. |
| setSpacingBefore | Paragraph | Sets the spacing before the element, in points. |
| setText | void | Sets the contents of the paragraph as text. |
| setTextAlignment | Paragraph | Sets the text alignment. |
Class Position
| メソッド名 | 返り値 | 簡単な説明 |
| getElement | Element | Gets the element that contains this Position. |
| getOffset | Integer | Gets this Position’s relative location within the element that contains it. |
| getSurroundingText | Text | Creates an artificial Text element that represents the text and formatting of the Paragraph or ListItem that contains the Position, either directly or through a chain of child elements. |
| getSurroundingTextOffset | Integer | Gets the offset of this Position within the Text element returned by getSurroundingText(). |
| insertBookmark | Bookmark | Creates and inserts a new Bookmark at this Position. |
| insertInlineImage | InlineImage | Creates and inserts a new InlineImage at this Position from the specified image blob. |
| insertText | Text | Inserts the specified text at this Position. |
Class PositionedImage
| メソッド名 | 返り値 | 簡単な説明 |
| getAs | Blob | Return the data inside this object as a blob converted to the specified content type. |
| getBlob | Blob | Return the data inside this object as a blob. |
| getHeight | Integer | Retrieves the image’s height, in pixels. |
| getId | String | Gets the image’s ID. |
| getLayout | PositionedLayout | Gets an enum value that represents how the image is laid out. |
| getLeftOffset | Number | Gets the image’s offset, in points, from the paragraph’s left. |
| getParagraph | Paragraph | Gets the Paragraph the image is anchored to. |
| getTopOffset | Number | Gets the image’s offset, in points, from the paragraph’s top. |
| getWidth | Integer | Retrieves the image’s width, in pixels. |
| setHeight | PositionedImage | Sets the image’s height, in pixels. |
| setLayout | PositionedImage | Sets the definition of how the image is laid out. |
| setLeftOffset | PositionedImage | Sets the image’s offset, in points, from the paragraph’s left. |
| setTopOffset | PositionedImage | Sets the image’s offset, in points, from the paragraph’s top. |
| setWidth | PositionedImage | Sets the image’s width, in pixels. |
Class Range
| メソッド名 | 返り値 | 簡単な説明 |
| getRangeElements | RangeElement[] | Gets all elements in this Range, including any partial Text elements (for example, in the case of a selection that includes only part of a Text element). |
Class RangeBuilder
| メソッド名 | 返り値 | 簡単な説明 |
| addElement | RangeBuilder | Adds an entire Element to this RangeBuilder. |
| addElementsBetween | RangeBuilder | Adds two entire elements, and all elements between them, to this RangeBuilder. |
| addRange | RangeBuilder | Adds the contents of another Range to this RangeBuilder. |
| build | Range | Constructs a Range from the settings applied to the builder. |
| getRangeElements | RangeElement[] | Gets all elements in this Range, including any partial Text elements (for example, in the case of a selection that includes only part of a Text element). |
Class Table
| メソッド名 | 返り値 | 簡単な説明 |
| appendTableRow | TableRow | Creates and appends a new TableRow. |
| clear | Table | Clears the contents of the element. |
| copy | Table | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getBorderColor | String | Retrieves the border color. |
| getBorderWidth | Number | Retrieves the border width, in points. |
| getCell | TableCell | Retrieves the TableCell at the specified row and cell indices. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getColumnWidth | Number | Retrieves the width of the specified table column, in points. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getNumRows | Integer | Retrieves the number of TableRows. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getRow | TableRow | Retrieves the TableRow at the specified row index. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertTableRow | TableRow | Creates and inserts a new TableRow at the specified index. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| removeChild | Table | Removes the specified child element. |
| removeFromParent | Table | Removes the element from its parent. |
| removeRow | TableRow | Removes the TableRow at the specified row index. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | Table | Sets the element’s attributes. |
| setBorderColor | Table | Sets the border color. |
| setBorderWidth | Table | Sets the border width, in points. |
| setColumnWidth | Table | Sets the width of the specified column, in points. |
| setLinkUrl | Table | Sets the link url. |
| setTextAlignment | Table | Sets the text alignment. |
Class TableCell
| メソッド名 | 返り値 | 簡単な説明 |
| appendHorizontalRule | HorizontalRule | Creates and appends a new HorizontalRule. |
| appendImage | InlineImage | Creates and appends a new InlineImage from the specified image blob. |
| appendListItem | ListItem | Appends the given ListItem. |
| appendParagraph | Paragraph | Appends the given Paragraph. |
| appendTable | Table | Creates and appends a new Table. |
| clear | TableCell | Clears the contents of the element. |
| copy | TableCell | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getBackgroundColor | String | Retrieves the background color. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getColSpan | Integer | Retrieves the column span, which is the number of columns of table cells this cell spans. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getPaddingBottom | Number | Retrieves the bottom padding, in points. |
| getPaddingLeft | Number | Retrieves the left padding, in points. |
| getPaddingRight | Number | Retrieves the right padding, in points. |
| getPaddingTop | Number | Retrieves the top padding, in points. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getParentRow | TableRow | Retrieves the TableRow containing the current TableCell. |
| getParentTable | Table | Retrieves the Table containing the current TableCell. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getRowSpan | Integer | Retrieves the row span, which is the number of rows of table cells this cell spans. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| getVerticalAlignment | VerticalAlignment | Retrieves the VerticalAlignment. |
| getWidth | Number | Retrieves the width of the column containing the cell, in points. |
| insertHorizontalRule | HorizontalRule | Creates and inserts a new HorizontalRule at the specified index. |
| insertImage | InlineImage | Creates and inserts an InlineImage from the specified image blob, at the specified index. |
| insertListItem | ListItem | Inserts the given ListItem at the specified index. |
| insertParagraph | Paragraph | Inserts the given Paragraph at the specified index. |
| insertTable | Table | Creates and inserts a new Table at the specified index. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | TableCell | Merges the element with the preceding sibling of the same type. |
| removeChild | TableCell | Removes the specified child element. |
| removeFromParent | TableCell | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | TableCell | Sets the element’s attributes. |
| setBackgroundColor | TableCell | Sets the background color. |
| setLinkUrl | TableCell | Sets the link url. |
| setPaddingBottom | TableCell | Sets the bottom padding, in points. |
| setPaddingLeft | TableCell | Sets the left padding, in points. |
| setPaddingRight | TableCell | Sets the right padding, in points. |
| setPaddingTop | TableCell | Sets the top padding, in points. |
| setText | TableCell | Sets the contents as plain text. |
| setTextAlignment | TableCell | Sets the text alignment. |
| setVerticalAlignment | TableCell | Sets the vertical alignment. |
| setWidth | TableCell | Sets the width of the column containing the current cell, in points. |
Class TableOfContents
| メソッド名 | 返り値 | 簡単な説明 |
| clear | TableOfContents | Clears the contents of the element. |
| copy | TableOfContents | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| removeFromParent | TableOfContents | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | TableOfContents | Sets the element’s attributes. |
| setLinkUrl | TableOfContents | Sets the link url. |
| setTextAlignment | TableOfContents | Sets the text alignment. |
Class TableRow
| メソッド名 | 返り値 | 簡単な説明 |
| appendTableCell | TableCell | Creates and appends a new TableCell. |
| clear | TableRow | Clears the contents of the element. |
| copy | TableRow | Returns a detached, deep copy of the current element. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findElement | RangeElement | Searches the contents of the element for a descendant of the specified type. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getCell | TableCell | Retrieves the TableCell at the specified cell index. |
| getChild | Element | Retrieves the child element at the specified child index. |
| getChildIndex | Integer | Retrieves the child index for the specified child element. |
| getLinkUrl | String | Retrieves the link url. |
| getMinimumHeight | Number | Retrieves the minimum height, in points. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getNumCells | Integer | Retrieves the number of cells in the row. |
| getNumChildren | Integer | Retrieves the number of children. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getParentTable | Table | Retrieves the Table containing the current row. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertTableCell | TableCell | Creates and inserts a new TableCell at the specified index. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | TableRow | Merges the element with the preceding sibling of the same type. |
| removeCell | TableCell | Removes the TableCell at the specified cell index. |
| removeChild | TableRow | Removes the specified child element. |
| removeFromParent | TableRow | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | TableRow | Sets the element’s attributes. |
| setLinkUrl | TableRow | Sets the link url. |
| setMinimumHeight | TableRow | Sets the minimum height, in points. |
| setTextAlignment | TableRow | Sets the text alignment. |
Class Text
| メソッド名 | 返り値 | 簡単な説明 |
| appendText | Text | Adds the specified text to the end of this text region. |
| copy | Text | Returns a detached, deep copy of the current element. |
| deleteText | Text | Deletes a range of text. |
| editAsText | Text | Obtains a Text version of the current element, for editing. |
| findText | RangeElement | Searches the contents of the element for the specified text pattern using regular expressions. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getBackgroundColor | String | Retrieves the background color setting. |
| getFontFamily | String | Retrieves the font family setting. |
| getFontSize | Number | Retrieves the font size setting. |
| getForegroundColor | String | Retrieves the foreground color setting. |
| getLinkUrl | String | Retrieves the link url. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getText | String | Retrieves the contents of the element as a text string. |
| getTextAlignment | TextAlignment | Gets the text alignment. |
| getTextAttributeIndices | Integer[] | Retrieves the set of text indices that correspond to the start of distinct text formatting runs. |
| getType | ElementType | Retrieves the element’s ElementType. |
| insertText | Text | Inserts the specified text at the given character offset. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| isBold | Boolean | Retrieves the bold setting. |
| isItalic | Boolean | Retrieves the italic setting. |
| isStrikethrough | Boolean | Retrieves the strikethrough setting. |
| isUnderline | Boolean | Retrieves the underline setting. |
| merge | Text | Merges the element with the preceding sibling of the same type. |
| removeFromParent | Text | Removes the element from its parent. |
| replaceText | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regular expressions. |
| setAttributes | Text | Applies the specified attributes to the given character range. |
| setBackgroundColor | Text | Sets the background color for the specified character range. |
| setBold | Text | Sets the bold setting. |
| setFontFamily | Text | Sets the font family for the specified character range. |
| setFontSize | Text | Sets the font size for the specified character range. |
| setForegroundColor | Text | Sets the foreground color for the specified character range. |
| setItalic | Text | Sets the italic setting. |
| setLinkUrl | Text | Sets the link url for the specified character range. |
| setStrikethrough | Text | Sets the strikethrough setting. |
| setText | Text | Sets the text contents. |
| setTextAlignment | Text | Sets the text alignment for a given character range. |
| setUnderline | Text | Sets the underline setting. |
Class UnsupportedElement
| メソッド名 | 返り値 | 簡単な説明 |
| copy | UnsupportedElement | Returns a detached, deep copy of the current element. |
| getAttributes | Object | Retrieves the element’s attributes. |
| getNextSibling | Element | Retrieves the element’s next sibling element. |
| getParent | ContainerElement | Retrieves the element’s parent element. |
| getPreviousSibling | Element | Retrieves the element’s previous sibling element. |
| getType | ElementType | Retrieves the element’s ElementType. |
| isAtDocumentEnd | Boolean | Determines whether the element is at the end of the Document. |
| merge | UnsupportedElement | Merges the element with the preceding sibling of the same type. |
| removeFromParent | UnsupportedElement | Removes the element from its parent. |
| setAttributes | UnsupportedElement | Sets the element’s attributes. |
列挙型名一覧
列挙型のメソッドを利用するときには、基本的には『DocumentApp.列挙型名.プロパティ名』の形で利用します。例えば、VerticalAlignmentのBOTTOMを設定したい場合は、『DocumentApp.VerticalAlignment.BOTTOM』という形で記述します。
Enoms Attribute
| プロパティ | タイプ | 説明 |
| BACKGROUND_COLOR | Enum | The background color of an element (Paragraph, Table, etc) or document. |
| BOLD | Enum | The font weight setting, for rich text. |
| BORDER_COLOR | Enum | The border color, for table elements. |
| BORDER_WIDTH | Enum | The border width in points, for table elements. |
| CODE | Enum | The code contents, for equation elements. |
| FONT_FAMILY | Enum | The font family setting, for rich text. |
| FONT_SIZE | Enum | The font size setting in points, for rich text. |
| FOREGROUND_COLOR | Enum | The foreground color setting, for rich text. |
| HEADING | Enum | The heading type, for paragraph elements (for example, DocumentApp.ParagraphHeading.HEADING1). |
| HEIGHT | Enum | The height setting, for image elements. |
| HORIZONTAL_ALIGNMENT | Enum | The horizontal alignment, for paragraph elements (for example, DocumentApp.HorizontalAlignment.CENTER). |
| INDENT_END | Enum | The end indentation setting in points, for paragraph elements. |
| INDENT_FIRST_LINE | Enum | The first line indentation setting in points, for paragraph elements. |
| INDENT_START | Enum | The start indentation setting in points, for paragraph elements. |
| ITALIC | Enum | The font style setting, for rich text. |
| GLYPH_TYPE | Enum | The glyph type, for list item elements. |
| LEFT_TO_RIGHT | Enum | The text direction setting, for rich text. |
| LINE_SPACING | Enum | The line spacing setting as a multiplier, for paragraph elements. |
| LINK_URL | Enum | The link URL, for rich text. The default link style (foreground color, underline) is automatically applied. |
| LIST_ID | Enum | The ID of the encompassing list, for list item elements. |
| MARGIN_BOTTOM | Enum | The bottom margin setting in points, for paragraph elements. |
| MARGIN_LEFT | Enum | The left margin setting in points, for paragraph elements. |
| MARGIN_RIGHT | Enum | The right margin setting in points, for paragraph elements. |
| MARGIN_TOP | Enum | The top margin setting in points, for paragraph elements. |
| NESTING_LEVEL | Enum | The item nesting level, for list item elements. |
| MINIMUM_HEIGHT | Enum | The minimum height setting in points, for table row elements. |
| PADDING_BOTTOM | Enum | The bottom padding setting in points, for table cell elements. |
| PADDING_LEFT | Enum | The left padding setting in points, for table cell elements. |
| PADDING_RIGHT | Enum | The right padding setting in points, for table cell elements. |
| PADDING_TOP | Enum | The top padding setting in points, for table cell elements. |
| PAGE_HEIGHT | Enum | The page height setting in points, for documents. |
| PAGE_WIDTH | Enum | The page width setting in points, for documents. |
| SPACING_AFTER | Enum | The bottom spacing setting in points, for paragraph elements. |
| SPACING_BEFORE | Enum | The top spacing setting in points, for paragraph elements. |
| STRIKETHROUGH | Enum | The strike-through setting, for rich text. |
| UNDERLINE | Enum | The underline setting, for rich text. |
| VERTICAL_ALIGNMENT | Enum | The vertical alignment setting, for table cell elements. |
| WIDTH | Enum | The width setting, for table cell and image elements. |
Enoms ElementType
ElementTypeはドキュメントの構成要素の種類を設定したり、構成要素を比較したりする場合に使用します。
function sampleCodeForGetAllCalendars() {
var firstChild = DocumentApp.getActiveDocument().getBody().getChild(0);
if (firstChild.getType() == DocumentApp.ElementType.PARAGRAPH) {
//本文セクションの1つ目の子要素が段落に設定されている場合は、要素をH1見出しに設定する処理
firstChild.asParagraph().setHeading(DocumentApp.ParagraphHeading.HEADING1);
}
}
| プロパティ | タイプ | 説明 |
| BODY_SECTION | Enum | 本文に対応する構成要素 |
| COMMENT_SECTION | Enum | コメントセクションに対応する構成要素 |
| DOCUMENT | Enum | ルートドキュメンに対応する構成要素 |
| EQUATION | Enum | 計算式に対応する構成要素 |
| EQUATION_FUNCTION | Enum | 関数に対応する構成要素 |
| EQUATION_FUNCTION_ ARGUMENT_SEPARATOR |
Enum | 計算式の引数分割に対応する構成要素 |
| EQUATION_SYMBOL | Enum | 計算式のシンボルに対応する構成要素 |
| FOOTER_SECTION | Enum | フッター部に対応する構成要素 |
| FOOTNOTE | Enum | 柱脚に対応する構成要素 |
| FOOTNOTE_SECTION | Enum | 柱脚セクションに対応する構成要素 |
| HEADER_SECTION | Enum | ヘッダー部に対応する構成要素 |
| HORIZONTAL_RULE | Enum | 水平方向のルールに対応する構成要素 |
| INLINE_DRAWING | Enum | インライン描画に対応する構成要素 |
| INLINE_IMAGE | Enum | インライン画像に対応する構成要素 |
| LIST_ITEM | Enum | 箇条書きに対応する構成要素 |
| PAGE_BREAK | Enum | 改行に対応する構成要素 |
| PARAGRAPH | Enum | 段落に対応する構成要素 |
| TABLE | Enum | 表に対応する構成要素 |
| TABLE_CELL | Enum | 表のセルに対応する構成要素 |
| TABLE_OF_CONTENTS | Enum | 目次に対応する構成要素 |
| TABLE_ROW | Enum | 表の列に対応する構成要素 |
| TEXT | Enum | 文字に対応する構成要素 |
| UNSUPPORTED | Enum | UnsupportedElementに対応する構成要素。UnsupportedElementはスクリプトが適用できない文書部分のこと |
Enoms FontFamily(非推奨)
FontFamilyはフォントの種類を設定します。 現在は非推奨です。
| プロパティ | タイプ | 説明 |
| AMARANTH | Enum | AMARANTHに設定する |
| ARIAL | Enum | ARIALに設定する |
| ARIAL_BLACK | Enum | The Arial Black font family. |
| ARIAL_NARROW | Enum | ARIAL_NARROWに設定する |
| ARVO | Enum | ARVOに設定する |
| CALIBRI | Enum | CALIBRIに設定する |
| CAMBRIA | Enum | CAMBRIAに設定する |
| COMIC_SANS_MS | Enum | COMIC_SANS_MSに設定する |
| CONSOLAS | Enum | CONSOLASに設定する |
| CORSIVA | Enum | CORSIVAに設定する |
| COURIER_NEW | Enum | COURIER_NEWに設定する |
| DANCING_SCRIPT | Enum | DANCING_SCRIPTに設定する |
| DROID_SANS | Enum | DROID_SANSに設定する |
| DROID_SERIF | Enum | DROID_SERIF |
| GARAMOND | Enum | GRAMONDに設定する |
| GEORGIA | Enum | GEORGIAに設定する |
| GLORIA_HALLELUJAH | Enum | GLORIA_HALLELUJAHに設定する |
| GREAT_VIBES | Enum | GREAT_VIBESに設定する |
| LOBSTER | Enum | LOBSTERに設定する |
| MERRIWEATHER | Enum | MERRIWEATHERに設定する |
| PACIFICO | Enum | PACIFICOに設定する |
| PHILOSOPHER | Enum | PHILOSOPHERに設定する |
| POIRET_ONE | Enum | POIRET_ONEに設定する |
| QUATTROCENTO | Enum | QUATTROCENTOに設定する |
| ROBOTO | Enum | ROBOTOに設定する |
| SHADOWS_INTO_LIGHT | Enum | SHADOWS_INTO_LIGHTに設定する |
| SYNCOPATE | Enum | SYNCOPATEに設定する |
| TAHOMA | Enum | TAHOMAに設定する |
| TIMES_NEW_ROMAN | Enum | TIMES_NEW_ROMANに設定する |
| TREBUCHET_MS | Enum | TREBUCHET_MSに設定する |
| UBUNTU | Enum | UBUNTUに設定する |
| VERDANA | Enum | VERDANAに設定する |
Enoms GlyphType
GlyphTypeは箇条書き設定を設定します。
| プロパティ | タイプ | 説明 |
| BULLET | Enum | ・ドット |
| HOLLOW_BULLET | Enum | ○ 中抜きドット |
| SQUARE_BULLET | Enum | □ スクエア |
| NUMBER | Enum | 数字 |
| LATIN_UPPER | Enum | 大文字アルファベット |
| LATIN_LOWER | Enum | 小文字アルファベット |
| ROMAN_UPPER | Enum | 大文字ローマ数字 |
| ROMAN_LOWER | Enum | 小文字ローマ数字 |
Enoms HorizontalAlignment
HorizontalAlignmentは水平方向の文字配置を設定します。
| プロパティ | タイプ | 説明 |
| LEFT | Enum | 左揃えオプション |
| CENTER | Enum | 中央揃えオプション |
| RIGHT | Enum | 右揃えオプション |
| JUSTIFY | Enum | 両端揃えオプション |
Enoms ParagraphHeading
ParagraphHeadingは段落見出しを設定します。
| プロパティ | タイプ | 説明 |
| NORMAL | Enum | 標準テキスト |
| HEADING1 | Enum | H1見出し |
| HEADING2 | Enum | H2見出し |
| HEADING3 | Enum | H3見出し |
| HEADING4 | Enum | H4見出し |
| HEADING5 | Enum | H5見出し |
| HEADING6 | Enum | H6見出し |
| TITLE | Enum | タイトル |
| SUBTITLE | Enum | サブタイトル |
Enoms PositionedLayout
PositionedLayoutは画像の配置方法を設定します。
| プロパティ | タイプ | 説明 |
| ABOVE_TEXT | Enum | 画像は文字の上部に配置されます。 |
| BREAK_BOTH | Enum | 画像は文字を左右に二等分して配置されます。 |
| BREAK_LEFT | Enum | The image breaks the text on the left. |
| BREAK_RIGHT | Enum | The image breaks the text on the right. |
| WRAP_TEXT | Enum | The image is wrapped by text. |
Enoms TextAlignment
TextAlignmentは文字配置を設定します。
| プロパティ | タイプ | 説明 |
| NORMAL | Enum | 通常配置 |
| SUPERSCRIPT | Enum | 上付き文字 |
| SUBSCRIPT | Enum | 下付き文字 |
Enoms VerticalAlignment
VerticalAlignmentは垂直方向の文字配置を設定します。
| プロパティ | タイプ | 説明 |
| BOTTOM | Enum | 文字の下揃えオプション |
| CENTER | Enum | 文字の中央揃えオプション |
| TOP | Enum | 文字の上揃えオプション |












コメント
コメント一覧 (1件)
[…] Googleドキュメント […]