Document Service Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The Google Apps Script Document service allows programmatic creation, access, and modification of Google Docs files.
DocumentAppis the main class for creating and opening documents, while theDocumentclass manages the document as a whole.The service provides numerous classes to represent document elements, such as
Body,Paragraph,Table, andText, each with methods for manipulation.Attributes like font size, color, and alignment can be controlled using the
Attributeenumeration.The
Elementclass serves as a base for all document components, offering general methods for accessing properties and navigating the document structure.
This service allows scripts to create, access, and modify Google Docs files.
//OpenadocumentbyID.vardoc=DocumentApp.openById('DOCUMENT_ID');//Createandopenadocument.doc=DocumentApp.create('Document Name');Classes
| Name | Brief description |
|---|---|
Attribute | An enumeration of the element attributes. |
Body | The content of a tab in a Google Docs document. |
Bookmark | An object representing a bookmark. |
Container | A generic element that may contain other elements. |
Date | An element representing a formatted date |
Document | A document, containing one or moreTab objects, each of which contains rich text andelements such as tables and lists. |
Document | The document service creates and opensDocuments that can be edited. |
Document | A document tab, containing rich text and elements such as tables and lists. |
Element | A generic element. |
Element | An enumeration of all the element types. |
Equation | An element representing a mathematical expression. |
Equation | An element representing a function in a mathematicalEquation. |
Equation | An element representing a function separator in a mathematicalEquation. |
Equation | An element representing a symbol in a mathematicalEquation. |
| An enumeration of the supported fonts. |
Footer | An element representing a footer section. |
Footnote | An element representing a footnote. |
Footnote | An element representing a footnote section. |
Glyph | An enumeration of the supported glyph types. |
Header | An element representing a header section. |
Horizontal | An enumeration of the supported horizontal alignment types. |
Horizontal | An element representing an horizontal rule. |
Inline | An element representing an embedded drawing. |
Inline | An element representing an embedded image. |
List | An element representing a list item. |
Named | ARange that has a name and ID to allow later retrieval. |
Page | An element representing a page break. |
Paragraph | An element representing a paragraph. |
Paragraph | An enumeration of the standard paragraph headings. |
Person | An element representing a link to a person. |
Position | A reference to a location in the document tab, relative to a specific element. |
Positioned | Fixed position image anchored to aParagraph. |
Positioned | An enumeration that specifies how to lay out aPositioned in relation to surroundingtext. |
Range | A range of elements in a document. |
Range | A builder used to constructRange objects from document elements. |
Range | A wrapper around anElement with a possible start and end offset. |
Rich | An element representing a link to a Google resource, such as a Drive file or a YouTube video. |
Tab | A tab within a Google Docs document. |
Tab | An enumeration of all the tab types. |
Table | An element representing a table. |
Table | An element representing a table cell. |
Table | An element containing a table of contents. |
Table | An element representing a table row. |
Text | An element representing a rich text region. |
Text | An enumeration of the type of text alignments. |
Unsupported | An element representing a region that is unknown or cannot be affected by a script, such as apage number. |
Vertical | An enumeration of the supported vertical alignment types. |
Attribute
Properties
| Property | Type | Description |
|---|---|---|
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,Document). |
HEIGHT | Enum | The height setting, for image elements. |
HORIZONTAL_ALIGNMENT | Enum | The horizontal alignment, for paragraph elements (for example,Document). |
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. |
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. |
Body
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Horizontal | Creates and appends a newHorizontal. |
append | Inline | Creates and appends a newInline from the specified image blob. |
append | Inline | Appends the givenInline. |
append | List | Appends the givenList. |
append | List | Creates and appends a newList containing the specified text contents. |
append | Page | Creates and appends a newPage. |
append | Page | Appends the givenPage. |
append | Paragraph | Appends the givenParagraph. |
append | Paragraph | Creates and appends a newParagraph containing the specified text contents. |
append | Table | Creates and appends a newTable. |
append | Table | Appends a newTable containing aTable for each specified string value. |
append | Table | Appends the givenTable. |
clear() | Body | Clears the contents of the element. |
copy() | Body | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Object | Retrieves the set of attributes for the providedParagraph. |
get | Inline | Retrieves all theInline contained in the section. |
get | List | Retrieves all theList contained in the section. |
get | Number|null | Retrieves the bottom margin, in points. |
get | Number|null | Retrieves the left margin, in points. |
get | Number|null | Retrieves the right margin. |
get | Number|null | Retrieves the top margin. |
get | Integer | Retrieves the number of children. |
get | Number|null | Retrieves the page height, in points. |
get | Number|null | Retrieves the page width, in points. |
get | Paragraph[]|null | Retrieves all theParagraphs contained in the section (includingList). |
get | Container | Retrieves the element's parent element. |
get | Table[]|null | Retrieves all theTables contained in the section. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Horizontal | Creates and inserts a newHorizontal at the specified index. |
insert | Inline | Creates and inserts anInline from the specified image blob, at the specifiedindex. |
insert | Inline | Inserts the givenInline at the specified index. |
insert | List | Inserts the givenList at the specified index. |
insert | List | Creates and inserts a newList at the specified index, containing the specifiedtext contents. |
insert | Page | Creates and inserts a newPage at the specified index. |
insert | Page | Inserts the givenPage at the specified index. |
insert | Paragraph | Inserts the givenParagraph at the specified index. |
insert | Paragraph | Creates and inserts a newParagraph at the specified index, containing the specifiedtext contents. |
insert | Table | Creates and inserts a newTable at the specified index. |
insert | Table | Creates and inserts a newTable containing the specified cells, at the specified index. |
insert | Table | Inserts the givenTable at the specified index. |
remove | Body | Removes the specified child element. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Body | Sets the element's attributes. |
set | Body | Sets the attributes for the providedParagraph. |
set | Body | Sets the bottom margin, in points. |
set | Body | Sets the left margin, in points. |
set | Body | Sets the right margin, in points. |
set | Body | Sets the top margin. |
set | Body | Sets the page height, in points. |
set | Body | Sets the page width, in points. |
set | Body | Sets the contents as plain text. |
set | Body | Sets the text alignment. |
Bookmark
Methods
| Method | Return type | Brief description |
|---|---|---|
get | String | Gets the ID of theBookmark. |
get | Position | Gets thePosition of theBookmark within theDocument. |
remove() | void | Deletes theBookmark. |
ContainerElement
Methods
| Method | Return type | Brief description |
|---|---|---|
as | Body | Returns the current element as aBody. |
as | Equation | Returns the current element as anEquation. |
as | Footer | Returns the current element as aFooter. |
as | Footnote | Returns the current element as aFootnote. |
as | Header | Returns the current element as aHeader. |
as | List | Returns the current element as aList. |
as | Paragraph | Returns the current element as aParagraph. |
as | Table | Returns the current element as aTable. |
as | Table | Returns the current element as aTable. |
as | Table | Returns the current element as aTable. |
as | Table | Returns the current element as aTable. |
clear() | Container | Clears the contents of the element. |
copy() | Container | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | String|null | Retrieves the link url. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Container | Merges the element with the preceding sibling of the same type. |
remove | Container | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Container | Sets the element's attributes. |
set | Container | Sets the link url. |
set | Container | Sets the text alignment. |
Date
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Date | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | String | Returns the display value that's rendered in the document. |
get | String | Returns the date's locale used for the display value. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Date | Returns the timestamp associated with the date. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Date|null | Merges the element with the preceding sibling of the same type. |
remove | Date|null | Removes the element from its parent. |
set | Date | Sets the element's attributes. |
Document
Methods
| Method | Return type | Brief description |
|---|---|---|
add | Bookmark | Adds aBookmark at the givenPosition to the first tab or, for scripts that arebound to a document, the active tab. |
add | Document | Adds the given user to the list of editors for theDocument. |
add | Document | Adds the given user to the list of editors for theDocument. |
add | Document | Adds the given array of users to the list of editors for theDocument. |
add | Footer | Adds a footer section, if none exists, to the first tab or, for scripts that arebound to a document, the active tab. |
add | Header | Adds a header section, if none exists, to the first tab or, for scripts that arebound to a document, the active tab. |
add | Named | Adds aNamed, which is aRange that has a name and ID to use forlater retrieval, in the first tab or, for scripts that arebound to a document, the active tab. |
add | Document | Adds the given user to the list of viewers for theDocument. |
add | Document | Adds the given user to the list of viewers for theDocument. |
add | Document | Adds the given array of users to the list of viewers for theDocument. |
get | Tab | Gets the user's currently activeTab in the document. |
get | Blob | Retrieves the currentDocument contents as a blob of the specified type. |
get | Blob | Retrieves the currentDocument contents as a blob. |
get | Body | Retrieves the first tab'sBody or, for scripts that arebound to a document, the active tab'sDocument. |
get | Bookmark|null | Gets theBookmark with the given ID in the first tab or, for scripts that arebound to a document, the active tab. |
get | Bookmark[] | Gets allBookmark objects in the first tab or, for scripts that arebound to a document, the active tab. |
get | Position|null | Gets the user's cursor in the active tab. |
get | User[] | Gets the list of editors for thisDocument. |
get | Footer | Retrieves the first tab's footer section or, for scripts that arebound to a document, the active tab's footersection. |
get | Footnote[]|null | Retrieves all theFootnote elements in the first tab's body or, for scripts that arebound to a document, the active tab's body. |
get | Header | Retrieves the first tab's header section or, for scripts that arebound to a document, the active tab's headersection. |
get | String | Retrieves the document's unique identifier. |
get | String | Gets the document's language code. |
get | String | Retrieves the title of the document. |
get | Named | Gets theNamed with the given ID in the first tab or, for scripts that arebound to a document, the active tab. |
get | Named | Gets allNamed objects in the first tab or, for scripts that arebound to a document, the active tab. |
get | Named | Gets allNamed objects with the given name in the first tab or, for scripts thatarebound to a document, the active tab. |
get | Range|null | Gets the user's selection in the active tab. |
get | String[] | Gets all language codes that are supported in Google Docs files. |
get | Tab | Gets theTab with the specified ID. |
get | Tab[] | Gets all unnestedTabs that are part of the document. |
get | String | Retrieves the URL to access the current document. |
get | User[] | Gets the list of viewers and commenters for thisDocument. |
new | Position | Creates a newPosition, which is a reference to a location in the tab, relative to aspecific element in the first tab or, for scripts that arebound to a document, the active tab. |
new | Range | Creates a builder used to constructRange objects from tab elements in thefirst tab or, for scripts that arebound to adocument, the active tab. |
remove | Document | Removes the given user from the list of editors for theDocument. |
remove | Document | Removes the given user from the list of editors for theDocument. |
remove | Document | Removes the given user from the list of viewers and commenters for theDocument. |
remove | Document | Removes the given user from the list of viewers and commenters for theDocument. |
save | void | Saves the currentDocument. |
set | void | Sets the user's selectedTab in the current document to the tab with the specified ID. |
set | Document | Sets the user's cursor, given aPosition. |
set | Document | Sets the document's language code. |
set | Document | Sets the document title. |
set | Document | Sets the user's selection in the active tab, given aRange. |
DocumentApp
Properties
| Property | Type | Description |
|---|---|---|
Attribute | Attribute | TheAttribute enumeration. |
Element | Element | TheElement enumeration. |
Font | | The enumeration. |
Glyph | Glyph | TheGlyph enumeration. |
Horizontal | Horizontal | TheHorizontal enumeration. |
Paragraph | Paragraph | TheParagraph enumeration. |
Positioned | Positioned | ThePositioned enumeration. |
Text | Text | TheText enumeration. |
Vertical | Vertical | TheVertical enumeration. |
Methods
| Method | Return type | Brief description |
|---|---|---|
create(name) | Document | Creates and returns a new document. |
get | Document | Returns the document to which the script iscontainer-bound. |
get | Ui | Returns an instance of the document's user-interface environment that allows the script to addfeatures like menus, dialogs, and sidebars. |
open | Document | Returns the document with the specified ID. |
open | Document | Opens and returns the document with the specified URL. |
DocumentTab
Methods
| Method | Return type | Brief description |
|---|---|---|
add | Bookmark | Adds aBookmark at the givenPosition. |
add | Footer | Adds a tab footer section, if none exists. |
add | Header | Adds a tab header section, if none exists. |
add | Named | Adds aNamed, which is aRange that has a name and ID to use forlater retrieval. |
get | Body | Retrieves the tab'sBody. |
get | Bookmark|null | Gets theBookmark with the given ID. |
get | Bookmark[] | Gets allBookmark objects in the tab. |
get | Footer | Retrieves the tab's footer section, if one exists. |
get | Footnote[]|null | Retrieves all theFootnote elements in the tab's body. |
get | Header | Retrieves the tab's header section, if one exists. |
get | Named | Gets theNamed with the given ID. |
get | Named | Gets allNamed objects in the tab. |
get | Named | Gets allNamed objects in the tab with the given name. |
new | Position | Creates a newPosition, which is a reference to a location in the tab, relative to aspecific element. |
new | Range | Creates a builder used to constructRange objects from tab elements. |
Element
Methods
| Method | Return type | Brief description |
|---|---|---|
as | Body | Returns the current element as aBody. |
as | Date | Returns the current element as aDate. |
as | Equation | Returns the current element as anEquation. |
as | Equation | Returns the current element as aEquation. |
as | Equation | Returns the current element as aEquation. |
as | Equation | Returns the current element as aEquation. |
as | Footer | Returns the current element as aFooter. |
as | Footnote | Returns the current element as aFootnote. |
as | Footnote | Returns the current element as aFootnote. |
as | Header | Returns the current element as aHeader. |
as | Horizontal | Returns the current element as aHorizontal. |
as | Inline | Returns the current element as aInline. |
as | Inline | Returns the current element as aInline. |
as | List | Returns the current element as aList. |
as | Page | Returns the current element as aPage. |
as | Paragraph | Returns the current element as aParagraph. |
as | Person | Returns the current element as aPerson. |
as | Rich | Returns the current element as aRich, for example, a link to a Google Sheets file. |
as | Table | Returns the current element as aTable. |
as | Table | Returns the current element as aTable. |
as | Table | Returns the current element as aTable. |
as | Table | Returns the current element as aTable. |
as | Text | Returns the current element as aText. |
copy() | Element | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Element|null | Merges the element with the preceding sibling of the same type. |
remove | Element|null | Removes the element from its parent. |
set | Element | Sets the element's attributes. |
ElementType
Properties
| Property | Type | Description |
|---|---|---|
BODY_SECTION | Enum | The type corresponding to theBody element. |
COMMENT_SECTION | Enum | The type corresponding to the element. |
DATE | Enum | The type corresponding to theDateelement. |
EQUATION | Enum | The type corresponding to theEquation element. |
EQUATION_FUNCTION | Enum | The type corresponding to theEquation element. |
EQUATION_FUNCTION_ARGUMENT_SEPARATOR | Enum | The type corresponding to theEquationelement. |
EQUATION_SYMBOL | Enum | The type corresponding to theEquation element. |
RICH_LINK | Enum | The type corresponding to theRich element. |
FOOTER_SECTION | Enum | The type corresponding to theFooter element. |
FOOTNOTE | Enum | The type corresponding to theFootnote element. |
FOOTNOTE_SECTION | Enum | The type corresponding to theFootnote element. |
HEADER_SECTION | Enum | The type corresponding to theHeader element. |
HORIZONTAL_RULE | Enum | The type corresponding to theHorizontal element. |
INLINE_DRAWING | Enum | The type corresponding to theInline element. |
INLINE_IMAGE | Enum | The type corresponding to theInline element. |
LIST_ITEM | Enum | The type corresponding to theList element. |
PAGE_BREAK | Enum | The type corresponding to thePage element. |
PARAGRAPH | Enum | The type corresponding to theParagraph element. |
PERSON | Enum | The type corresponding to thePerson element. |
TABLE | Enum | The type corresponding to theTable element. |
TABLE_CELL | Enum | The type corresponding to theTable element. |
TABLE_OF_CONTENTS | Enum | The type corresponding to theTable element. |
TABLE_ROW | Enum | The type corresponding to theTable element. |
TEXT | Enum | The type corresponding to theTextelement. |
UNSUPPORTED | Enum | The type corresponding toUnsupported. |
Equation
Methods
| Method | Return type | Brief description |
|---|---|---|
clear() | Equation | Clears the contents of the element. |
copy() | Equation | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | String|null | Retrieves the link url. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Equation|null | Merges the element with the preceding sibling of the same type. |
remove | Equation|null | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Equation | Sets the element's attributes. |
set | Equation | Sets the link url. |
set | Equation | Sets the text alignment. |
EquationFunction
Methods
| Method | Return type | Brief description |
|---|---|---|
clear() | Equation | Clears the contents of the element. |
copy() | Equation | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | String | Retrieves the code corresponding to the equation function. |
get | String|null | Retrieves the link url. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Equation | Merges the element with the preceding sibling of the same type. |
remove | Equation | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Equation | Sets the element's attributes. |
set | Equation | Sets the link url. |
set | Equation | Sets the text alignment. |
EquationFunctionArgumentSeparator
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Equation | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Equation | Merges the element with the preceding sibling of the same type. |
remove | Equation | Removes the element from its parent. |
set | Equation | Sets the element's attributes. |
EquationSymbol
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Equation | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | String | Retrieves the code corresponding to the equation symbol. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Equation | Merges the element with the preceding sibling of the same type. |
remove | Equation | Removes the element from its parent. |
set | Equation | Sets the element's attributes. |
FontFamily
FooterSection
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Horizontal | Creates and appends a newHorizontal. |
append | Inline | Creates and appends a newInline from the specified image blob. |
append | Inline | Appends the givenInline. |
append | List | Appends the givenList. |
append | List | Creates and appends a newList containing the specified text contents. |
append | Paragraph | Appends the givenParagraph. |
append | Paragraph | Creates and appends a newParagraph containing the specified text contents. |
append | Table | Creates and appends a newTable. |
append | Table | Appends a newTable containing aTable for each specified string value. |
append | Table | Appends the givenTable. |
clear() | Footer | Clears the contents of the element. |
copy() | Footer | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Inline | Retrieves all theInline contained in the section. |
get | List | Retrieves all theList contained in the section. |
get | Integer | Retrieves the number of children. |
get | Paragraph[]|null | Retrieves all theParagraphs contained in the section (includingList). |
get | Container | Retrieves the element's parent element. |
get | Table[]|null | Retrieves all theTables contained in the section. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Horizontal | Creates and inserts a newHorizontal at the specified index. |
insert | Inline | Creates and inserts anInline from the specified image blob, at the specifiedindex. |
insert | Inline | Inserts the givenInline at the specified index. |
insert | List | Inserts the givenList at the specified index. |
insert | List | Creates and inserts a newList at the specified index, containing the specifiedtext contents. |
insert | Paragraph | Inserts the givenParagraph at the specified index. |
insert | Paragraph | Creates and inserts a newParagraph at the specified index, containing the specifiedtext contents. |
insert | Table | Creates and inserts a newTable at the specified index. |
insert | Table | Creates and inserts a newTable containing the specified cells, at the specified index. |
insert | Table | Inserts the givenTable at the specified index. |
remove | Footer | Removes the specified child element. |
remove | Footer | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Footer | Sets the element's attributes. |
set | Footer | Sets the contents as plain text. |
set | Footer | Sets the text alignment. |
Footnote
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Footnote | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | Footnote | Retrieves the contents of the footnote element. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
remove | Footnote|null | Removes the element from its parent. |
set | Footnote | Sets the element's attributes. |
FootnoteSection
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Paragraph | Appends the givenParagraph. |
append | Paragraph | Creates and appends a newParagraph containing the specified text contents. |
clear() | Footnote | Clears the contents of the element. |
copy() | Footnote | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Paragraph[]|null | Retrieves all theParagraphs contained in the section (includingList). |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Paragraph | Inserts the givenParagraph at the specified index. |
insert | Paragraph | Creates and inserts a newParagraph at the specified index, containing the specifiedtext contents. |
remove | Footnote | Removes the specified child element. |
remove | Footnote | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Footnote | Sets the element's attributes. |
set | Footnote | Sets the contents as plain text. |
set | Footnote | Sets the text alignment. |
GlyphType
Properties
| Property | Type | Description |
|---|---|---|
BULLET | Enum | The default bullet, circular and filled. |
HOLLOW_BULLET | Enum | A hollow bullet. |
SQUARE_BULLET | Enum | A square bullet. |
NUMBER | Enum | A number based bullet. |
LATIN_UPPER | Enum | A latin, uppercase bullet. |
LATIN_LOWER | Enum | A latin, lowercase bullet. |
ROMAN_UPPER | Enum | A roman numeral, uppercase bullet. |
ROMAN_LOWER | Enum | A roman numeral, lowercase bullet. |
HeaderSection
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Horizontal | Creates and appends a newHorizontal. |
append | Inline | Creates and appends a newInline from the specified image blob. |
append | Inline | Appends the givenInline. |
append | List | Appends the givenList. |
append | List | Creates and appends a newList containing the specified text contents. |
append | Paragraph | Appends the givenParagraph. |
append | Paragraph | Creates and appends a newParagraph containing the specified text contents. |
append | Table | Creates and appends a newTable. |
append | Table | Appends a newTable containing aTable for each specified string value. |
append | Table | Appends the givenTable. |
clear() | Header | Clears the contents of the element. |
copy() | Header | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Inline | Retrieves all theInline contained in the section. |
get | List | Retrieves all theList contained in the section. |
get | Integer | Retrieves the number of children. |
get | Paragraph[]|null | Retrieves all theParagraphs contained in the section (includingList). |
get | Container | Retrieves the element's parent element. |
get | Table[]|null | Retrieves all theTables contained in the section. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Horizontal | Creates and inserts a newHorizontal at the specified index. |
insert | Inline | Creates and inserts anInline from the specified image blob, at the specifiedindex. |
insert | Inline | Inserts the givenInline at the specified index. |
insert | List | Inserts the givenList at the specified index. |
insert | List | Creates and inserts a newList at the specified index, containing the specifiedtext contents. |
insert | Paragraph | Inserts the givenParagraph at the specified index. |
insert | Paragraph | Creates and inserts a newParagraph at the specified index, containing the specifiedtext contents. |
insert | Table | Creates and inserts a newTable at the specified index. |
insert | Table | Creates and inserts a newTable containing the specified cells, at the specified index. |
insert | Table | Inserts the givenTable at the specified index. |
remove | Header | Removes the specified child element. |
remove | Header | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Header | Sets the element's attributes. |
set | Header | Sets the contents as plain text. |
set | Header | Sets the text alignment. |
HorizontalAlignment
Properties
| Property | Type | Description |
|---|---|---|
LEFT | Enum | The left-alignment option. |
CENTER | Enum | The center-alignment option. |
RIGHT | Enum | The right-alignment option. |
JUSTIFY | Enum | The justify-alignment option. |
HorizontalRule
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Horizontal | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
remove | Horizontal | Removes the element from its parent. |
set | Horizontal | Sets the element's attributes. |
InlineDrawing
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Inline | Returns a detached, deep copy of the current element. |
get | String|null | Returns the drawing's alternate description. |
get | String|null | Returns the drawing's alternate title. |
get | Object | Retrieves the element's attributes. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Inline | Merges the element with the preceding sibling of the same type. |
remove | Inline | Removes the element from its parent. |
set | Inline | Sets the drawing's alternate description. |
set | Inline | Sets the drawing's alternate title. |
set | Inline | Sets the element's attributes. |
InlineImage
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Inline | Returns a detached, deep copy of the current element. |
get | String|null | Returns the image's alternate description. |
get | String|null | Returns the image's alternate title. |
get | Blob | Return the data inside this object as a blob converted to the specified content type. |
get | Object | Retrieves the element's attributes. |
get | Blob | Return the data inside this object as a blob. |
get | Integer | Retrieves the image's height, in pixels. |
get | String|null | Retrieves the link URL. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
get | Integer | Retrieves the image's width, in pixels. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Inline | Merges the element with the preceding sibling of the same type. |
remove | Inline | Removes the element from its parent. |
set | Inline | Sets the image's alternate description. |
set | Inline | Sets the image's alternate title. |
set | Inline | Sets the element's attributes. |
set | Inline | Sets the image's height, in pixels. |
set | Inline | Sets the link URL. |
set | Inline | Sets the image's width, in pixels. |
ListItem
Methods
| Method | Return type | Brief description |
|---|---|---|
add | Positioned | Creates and inserts a newPositioned from the specified image blob. |
append | Horizontal | Creates and appends a newHorizontal. |
append | Inline | Creates and appends a newInline from the specified image blob. |
append | Inline | Appends the givenInline. |
append | Page | Creates and appends a newPage. |
append | Page | Appends the givenPage. |
append | Text | Creates and appends a newText element with the specified contents. |
append | Text | Appends the givenText element. |
clear() | List | Clears the contents of the element. |
copy() | List | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Horizontal | Retrieves theHorizontal. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Glyph | Retrieves the list item'sGlyph. |
get | Paragraph | Retrieves theParagraph. |
get | Number|null | Retrieves the end indentation, in points. |
get | Number|null | Retrieves the first line indentation, in points. |
get | Number|null | Retrieves the start indentation. |
get | Number|null | Retrieves the line spacing, in points. |
get | String|null | Retrieves the link url. |
get | String|null | Retrieves the list ID. |
get | Integer | Retrieves the list item's nesting level. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Container | Retrieves the element's parent element. |
get | Positioned | Gets aPositioned by the image's ID. |
get | Positioned | Gets allPositioned objects anchored to the paragraph. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Number|null | Retrieves the spacing after the element, in points. |
get | Number|null | Retrieves the spacing before the element, in points. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Horizontal | Creates and inserts aHorizontal at the specified index. |
insert | Inline | Creates and inserts a newInline from the specified image blob, at the specifiedindex. |
insert | Inline | Inserts the givenInline at the specified index. |
insert | Page | Creates and inserts a newPage at the specified index. |
insert | Page | Inserts the givenPage at the specified index. |
insert | Text | Creates and inserts a new text element at the specified index. |
insert | Text | Inserts the givenText element at the specified index, with the specified textcontents. |
is | Boolean | Determines whether the element is at the end of theDocument. |
is | Boolean|null | Retrieves the left-to-right setting. |
merge() | List | Merges the element with the preceding sibling of the same type. |
remove | List | Removes the specified child element. |
remove | List | Removes the element from its parent. |
remove | Boolean | Removes aPositioned by the image's ID. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | List | Sets theHorizontal. |
set | List | Sets the element's attributes. |
set | List | Sets the list item'sGlyph. |
set | List | Sets theParagraph. |
set | List | Sets the end indentation, in points. |
set | List | Sets the first line indentation, in points. |
set | List | Sets the start indentation, in points. |
set | List | Sets the left-to-right setting. |
set | List | Sets the line spacing, as a quantity indicating the number of lines to use for spacing. |
set | List | Sets the link url. |
set | List | Sets the list ID. |
set | List | Sets the list item's nesting level. |
set | List | Sets the spacing after the element, in points. |
set | List | Sets the spacing before the element, in points. |
set | void | Sets the contents of the list item as text. |
set | List | Sets the text alignment. |
NamedRange
Methods
| Method | Return type | Brief description |
|---|---|---|
get | String | Gets the ID of thisNamed. |
get | String | Gets the name of thisNamed. |
get | Range | Gets the range of elements associated with thisNamed. |
remove() | void | Removes thisNamed from the tab. |
PageBreak
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Page | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
remove | Page | Removes the element from its parent. |
set | Page | Sets the element's attributes. |
Paragraph
Methods
| Method | Return type | Brief description |
|---|---|---|
add | Positioned | Creates and inserts a newPositioned from the specified image blob. |
append | Horizontal | Creates and appends a newHorizontal. |
append | Inline | Creates and appends a newInline from the specified image blob. |
append | Inline | Appends the givenInline. |
append | Page | Creates and appends a newPage. |
append | Page | Appends the givenPage. |
append | Text | Creates and appends a newText element with the specified contents. |
append | Text | Appends the givenText element. |
clear() | Paragraph | Clears the contents of the element. |
copy() | Paragraph | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Horizontal | Retrieves theHorizontal. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Paragraph | Retrieves theParagraph. |
get | Number|null | Retrieves the end indentation, in points. |
get | Number|null | Retrieves the first line indentation, in points. |
get | Number|null | Retrieves the start indentation. |
get | Number|null | Retrieves the line spacing, in points. |
get | String|null | Retrieves the link url. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Container | Retrieves the element's parent element. |
get | Positioned | Gets aPositioned by the image's ID. |
get | Positioned | Gets allPositioned objects anchored to the paragraph. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Number|null | Retrieves the spacing after the element, in points. |
get | Number|null | Retrieves the spacing before the element, in points. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Horizontal | Creates and inserts aHorizontal at the specified index. |
insert | Inline | Creates and inserts a newInline from the specified image blob, at the specifiedindex. |
insert | Inline | Inserts the givenInline at the specified index. |
insert | Page | Creates and inserts a newPage at the specified index. |
insert | Page | Inserts the givenPage at the specified index. |
insert | Text | Creates and inserts a new text element at the specified index. |
insert | Text | Inserts the givenText element at the specified index, with the specified textcontents. |
is | Boolean | Determines whether the element is at the end of theDocument. |
is | Boolean|null | Retrieves the left-to-right setting. |
merge() | Paragraph|null | Merges the element with the preceding sibling of the same type. |
remove | Paragraph | Removes the specified child element. |
remove | Paragraph|null | Removes the element from its parent. |
remove | Boolean | Removes aPositioned by the image's ID. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Paragraph | Sets theHorizontal. |
set | Paragraph | Sets the element's attributes. |
set | Paragraph | Sets theParagraph. |
set | Paragraph | Sets the end indentation, in points. |
set | Paragraph | Sets the first line indentation, in points. |
set | Paragraph | Sets the start indentation, in points. |
set | Paragraph | Sets the left-to-right setting. |
set | Paragraph | Sets the line spacing, as a quantity indicating the number of lines to use for spacing. |
set | Paragraph | Sets the link url. |
set | Paragraph | Sets the spacing after the element, in points. |
set | Paragraph | Sets the spacing before the element, in points. |
set | void | Sets the contents of the paragraph as text. |
set | Paragraph | Sets the text alignment. |
ParagraphHeading
Properties
| Property | Type | Description |
|---|---|---|
NORMAL | Enum | The heading option for normal text. |
HEADING1 | Enum | The highest heading option. |
HEADING2 | Enum | The second heading option. |
HEADING3 | Enum | The third heading option |
HEADING4 | Enum | The fourth heading option. |
HEADING5 | Enum | The fifth heading option. |
HEADING6 | Enum | The lowest heading option. |
TITLE | Enum | The title heading option. |
SUBTITLE | Enum | The subtitle heading option. |
Person
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Person | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | String | Returns the person's email address. |
get | String|null | Returns the person's display name, if set. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Person|null | Merges the element with the preceding sibling of the same type. |
remove | Person|null | Removes the element from its parent. |
set | Person | Sets the element's attributes. |
Position
Methods
| Method | Return type | Brief description |
|---|---|---|
get | Element | Gets the element that contains thisPosition. |
get | Integer | Gets thisPosition's relative location within the element that contains it. |
get | Text | Creates an artificialText element that represents the text and formatting of theParagraph orList that contains thePosition, either directly or through a chain of child elements. |
get | Integer | Gets the offset of thisPosition within theText element returned byget. |
insert | Bookmark | Creates and inserts a newBookmark at thisPosition. |
insert | Inline | Creates and inserts a newInline at thisPosition from the specified imageblob. |
insert | Text|null | Inserts the specified text at thisPosition. |
PositionedImage
Methods
| Method | Return type | Brief description |
|---|---|---|
get | Blob | Return the data inside this object as a blob converted to the specified content type. |
get | Blob | Return the data inside this object as a blob. |
get | Integer | Retrieves the image's height, in pixels. |
get | String | Gets the image's ID. |
get | Positioned | Gets an enum value that represents how the image is laid out. |
get | Number | Gets the image's offset, in points, from the paragraph's left. |
get | Paragraph | Gets theParagraph the image is anchored to. |
get | Number | Gets the image's offset, in points, from the paragraph's top. |
get | Integer | Retrieves the image's width, in pixels. |
set | Positioned | Sets the image's height, in pixels. |
set | Positioned | Sets the definition of how the image is laid out. |
set | Positioned | Sets the image's offset, in points, from the paragraph's left. |
set | Positioned | Sets the image's offset, in points, from the paragraph's top. |
set | Positioned | Sets the image's width, in pixels. |
PositionedLayout
Properties
| Property | Type | Description |
|---|---|---|
ABOVE_TEXT | Enum | The image is positioned above the text. |
BREAK_BOTH | Enum | The image breaks the text on the left and right. |
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. |
Range
Methods
| Method | Return type | Brief description |
|---|---|---|
get | Range | Gets all elements in thisRange, including any partialText elements (for example, in the caseof a selection that includes only part of aText element). |
RangeBuilder
Methods
| Method | Return type | Brief description |
|---|---|---|
add | Range | Adds an entireElement to thisRange. |
add | Range | Adds a partialText element to thisRange. |
add | Range | Adds two entire elements, and all elements between them, to thisRange. |
add | Range | Adds two partialText elements, and all elements between them, to theRange. |
add | Range | Adds the contents of anotherRange to thisRange. |
build() | Range | Constructs aRange from the settings applied to the builder. |
get | Range | Gets all elements in thisRange, including any partialText elements (for example, in the caseof a selection that includes only part of aText element). |
RangeElement
Methods
| Method | Return type | Brief description |
|---|---|---|
get | Element | Gets theElement that corresponds to thisRange. |
get | Integer | Gets the position of the end of a partial range within the range element. |
get | Integer | Gets the position of the start of a partial range within the range element. |
is | Boolean | Determines whether this range element covers the entire element or a partial selection of theelement's characters. |
RichLink
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Rich | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | String|null | Returns theMIME type ofthe link, which is available when the item is a link to a Drive file andnullotherwise. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Returns the link's displayed title. |
get | Element | Retrieves the element'sElement. |
get | String | Returns the URL of the resource. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Rich | Merges the element with the preceding sibling of the same type. |
remove | Rich | Removes the element from its parent. |
set | Rich | Sets the element's attributes. |
Tab
Methods
| Method | Return type | Brief description |
|---|---|---|
as | Document | Retrieves the tab contents as aDocument. |
get | Tab[] | Retrieves the child tabs nested within this tab. |
get | String | Retrieves the ID of the tab. |
get | Integer | Retrieves the 0-based index of the tab within the parent. |
get | String | Retrieves the title of the tab. |
get | Tab | Retrieves the type of tab. |
TabType
Properties
| Property | Type | Description |
|---|---|---|
DOCUMENT_TAB | Enum | The type corresponding toDocument. |
Table
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Table | Creates and appends a newTable. |
append | Table | Appends the givenTable. |
clear() | Table | Clears the contents of the element. |
copy() | Table | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | String|null | Retrieves the border color. |
get | Number|null | Retrieves the border width, in points. |
get | Table | Retrieves theTable at the specified row and cell indices. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Number|null | Retrieves the width of the specified table column, in points. |
get | String|null | Retrieves the link url. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Integer | Retrieves the number ofTable. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Table | Retrieves theTable at the specified row index. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Table | Creates and inserts a newTable at the specified index. |
insert | Table | Inserts the givenTable at the specified index. |
is | Boolean | Determines whether the element is at the end of theDocument. |
remove | Table | Removes the specified child element. |
remove | Table|null | Removes the element from its parent. |
remove | Table | Removes theTable at the specified row index. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Table | Sets the element's attributes. |
set | Table | Sets the border color. |
set | Table | Sets the border width, in points. |
set | Table | Sets the width of the specified column, in points. |
set | Table | Sets the link url. |
set | Table | Sets the text alignment. |
TableCell
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Horizontal | Creates and appends a newHorizontal. |
append | Inline | Creates and appends a newInline from the specified image blob. |
append | Inline | Appends the givenInline. |
append | List | Appends the givenList. |
append | List | Creates and appends a newList. |
append | Paragraph | Appends the givenParagraph. |
append | Paragraph | Creates and appends a newParagraph. |
append | Table | Creates and appends a newTable. |
append | Table | Appends a newTable containing the specified cells. |
append | Table | Appends the givenTable. |
clear() | Table | Clears the contents of the element. |
copy() | Table | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | String|null | Retrieves the background color. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | Integer | Retrieves the column span, which is the number of columns of table cells this cell spans. |
get | String|null | Retrieves the link url. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Number|null | Retrieves the bottom padding, in points. |
get | Number|null | Retrieves the left padding, in points. |
get | Number|null | Retrieves the right padding, in points. |
get | Number|null | Retrieves the top padding, in points. |
get | Container | Retrieves the element's parent element. |
get | Table | Retrieves theTable containing the currentTable. |
get | Table|null | Retrieves theTable containing the currentTable. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Integer | Retrieves the row span, which is the number of rows of table cells this cell spans. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
get | Vertical | Retrieves theVertical. |
get | Number|null | Retrieves the width of the column containing the cell, in points. |
insert | Horizontal | Creates and inserts a newHorizontal at the specified index. |
insert | Inline | Creates and inserts anInline from the specified image blob, at the specifiedindex. |
insert | Inline | Inserts the givenInline at the specified index. |
insert | List | Inserts the givenList at the specified index. |
insert | List | Creates and inserts a newList at the specified index. |
insert | Paragraph | Inserts the givenParagraph at the specified index. |
insert | Paragraph | Creates and inserts a newParagraph at the specified index. |
insert | Table | Creates and inserts a newTable at the specified index. |
insert | Table | Creates and inserts a newTable containing the specified cells, at the specified index. |
insert | Table | Inserts the givenTable at the specified index. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Table | Merges the element with the preceding sibling of the same type. |
remove | Table | Removes the specified child element. |
remove | Table | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Table | Sets the element's attributes. |
set | Table | Sets the background color. |
set | Table | Sets the link url. |
set | Table | Sets the bottom padding, in points. |
set | Table | Sets the left padding, in points. |
set | Table | Sets the right padding, in points. |
set | Table | Sets the top padding, in points. |
set | Table | Sets the contents as plain text. |
set | Table | Sets the text alignment. |
set | Table | Sets the vertical alignment. |
set | Table | Sets the width of the column containing the current cell, in points. |
TableOfContents
Methods
| Method | Return type | Brief description |
|---|---|---|
clear() | Table | Clears the contents of the element. |
copy() | Table | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | String|null | Retrieves the link url. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of children. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
remove | Table | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Table | Sets the element's attributes. |
set | Table | Sets the link url. |
set | Table | Sets the text alignment. |
TableRow
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Table | Creates and appends a newTable. |
append | Table | Appends the givenTable containing the specified text. |
append | Table | Appends the givenTable. |
clear() | Table | Clears the contents of the element. |
copy() | Table | Returns a detached, deep copy of the current element. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for a descendant of the specified type. |
find | Range | Searches the contents of the element for a descendant of the specified type, starting from thespecifiedRange. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Table | Retrieves theTable at the specified cell index. |
get | Element | Retrieves the child element at the specified child index. |
get | Integer | Retrieves the child index for the specified child element. |
get | String|null | Retrieves the link url. |
get | Number|null | Retrieves the minimum height, in points. |
get | Element|null | Retrieves the element's next sibling element. |
get | Integer | Retrieves the number of cells in the row. |
get | Integer | Retrieves the number of children. |
get | Container | Retrieves the element's parent element. |
get | Table|null | Retrieves theTable containing the current row. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Element | Retrieves the element'sElement. |
insert | Table | Creates and inserts a newTable at the specified index. |
insert | Table | Inserts the givenTable at the specified index, containing the given text. |
insert | Table | Inserts the givenTable at the specified index. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Table | Merges the element with the preceding sibling of the same type. |
remove | Table | Removes theTable at the specified cell index. |
remove | Table | Removes the specified child element. |
remove | Table | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Table | Sets the element's attributes. |
set | Table | Sets the link url. |
set | Table | Sets the minimum height, in points. |
set | Table | Sets the text alignment. |
Text
Methods
| Method | Return type | Brief description |
|---|---|---|
append | Text | Adds the specified text to the end of this text region. |
copy() | Text | Returns a detached, deep copy of the current element. |
delete | Text | Deletes a range of text. |
edit | Text | Obtains aText version of the current element, for editing. |
find | Range | Searches the contents of the element for the specified text pattern using regular expressions. |
find | Range | Searches the contents of the element for the specified text pattern, starting from a givensearch result. |
get | Object | Retrieves the element's attributes. |
get | Object | Retrieves the attributes at the specified character offset. |
get | String|null | Retrieves the background color setting. |
get | String|null | Retrieves the background color at the specified character offset. |
get | String|null | Retrieves the font family setting. |
get | String|null | Retrieves the font family at the specified character offset. |
get | Number|null | Retrieves the font size setting. |
get | Number|null | Retrieves the font size at the specified character offset. |
get | String|null | Retrieves the foreground color setting. |
get | String|null | Retrieves the foreground color at the specified character offset. |
get | String|null | Retrieves the link url. |
get | String|null | Retrieves the link URL at the specified character offset. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | String | Retrieves the contents of the element as a text string. |
get | Text | Gets the text alignment. |
get | Text | Gets the text alignment for a single character. |
get | Integer[] | Retrieves the set of text indices that correspond to the start of distinct text formattingruns. |
get | Element | Retrieves the element'sElement. |
insert | Text | Inserts the specified text at the given character offset. |
is | Boolean | Determines whether the element is at the end of theDocument. |
is | Boolean|null | Retrieves the bold setting. |
is | Boolean|null | Retrieves the bold setting at the specified character offset. |
is | Boolean|null | Retrieves the italic setting. |
is | Boolean|null | Retrieves the italic setting at the specified character offset. |
is | Boolean|null | Retrieves the strikethrough setting. |
is | Boolean|null | Retrieves the strikethrough setting at the specified character offset. |
is | Boolean|null | Retrieves the underline setting. |
is | Boolean|null | Retrieves the underline setting at the specified character offset. |
merge() | Text|null | Merges the element with the preceding sibling of the same type. |
remove | Text|null | Removes the element from its parent. |
replace | Element | Replaces all occurrences of a given text pattern with a given replacement string, using regularexpressions. |
set | Text | Applies the specified attributes to the given character range. |
set | Text | Sets the element's attributes. |
set | Text | Sets the background color for the specified character range. |
set | Text | Sets the background color. |
set | Text | Sets the bold setting. |
set | Text | Sets the bold setting for the specified character range. |
set | Text | Sets the font family for the specified character range. |
set | Text | Sets the font family. |
set | Text | Sets the font size for the specified character range. |
set | Text | Sets the font size. |
set | Text | Sets the foreground color for the specified character range. |
set | Text | Sets the foreground color. |
set | Text | Sets the italic setting. |
set | Text | Sets the italic setting for the specified character range. |
set | Text | Sets the link URL for the specified character range. |
set | Text | Sets the link url. |
set | Text | Sets the strikethrough setting. |
set | Text | Sets the strikethrough setting for the specified character range. |
set | Text | Sets the text contents. |
set | Text | Sets the text alignment for a given character range. |
set | Text | Sets the text alignment. |
set | Text | Sets the underline setting. |
set | Text | Sets the underline setting for the specified character range. |
TextAlignment
Properties
| Property | Type | Description |
|---|---|---|
NORMAL | Enum | The normal text alignment. |
SUPERSCRIPT | Enum | The superscript text alignment. |
SUBSCRIPT | Enum | The subscript text alignment. |
UnsupportedElement
Methods
| Method | Return type | Brief description |
|---|---|---|
copy() | Unsupported | Returns a detached, deep copy of the current element. |
get | Object | Retrieves the element's attributes. |
get | Element|null | Retrieves the element's next sibling element. |
get | Container | Retrieves the element's parent element. |
get | Element|null | Retrieves the element's previous sibling element. |
get | Element | Retrieves the element'sElement. |
is | Boolean | Determines whether the element is at the end of theDocument. |
merge() | Unsupported | Merges the element with the preceding sibling of the same type. |
remove | Unsupported | Removes the element from its parent. |
set | Unsupported | Sets the element's attributes. |
VerticalAlignment
Properties
| Property | Type | Description |
|---|---|---|
BOTTOM | Enum | The bottom-alignment option. |
CENTER | Enum | The center-alignment option. |
TOP | Enum | The top-alignment option. |
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.