Stay organized with collections Save and categorize content based on your preferences.
ElementTypeAn enumeration of all the element types.
To call an enum, you call its parent class, name, and property. For example, DocumentApp.ElementType.BODY_SECTION
.
Use the ElementType
enumeration to check the type of a given element, for instance:
const documentTab = DocumentApp.getActiveDocument().getActiveTab().asDocumentTab(); const firstChild = documentTab.getBody().getChild(0); if (firstChild.getType() === DocumentApp.ElementType.PARAGRAPH) { // It's a paragraph, apply a paragraph heading. firstChild.asParagraph().setHeading(DocumentApp.ParagraphHeading.HEADING1); }Properties Property Type Description
BODY_SECTION
Enum
The type corresponding to the Body
element. COMMENT_SECTION
Enum
The type corresponding to the CommentSection
element. DATE
Enum
The type corresponding to the Date
element. EQUATION
Enum
The type corresponding to the Equation
element. EQUATION_FUNCTION
Enum
The type corresponding to the EquationFunction
element. EQUATION_FUNCTION_ARGUMENT_SEPARATOR
Enum
The type corresponding to the EquationFunctionArgumentSeparator
element. EQUATION_SYMBOL
Enum
The type corresponding to the EquationSymbol
element. RICH_LINK
Enum
The type corresponding to the RichLink
element. FOOTER_SECTION
Enum
The type corresponding to the FooterSection
element. FOOTNOTE
Enum
The type corresponding to the Footnote
element. FOOTNOTE_SECTION
Enum
The type corresponding to the FootnoteSection
element. HEADER_SECTION
Enum
The type corresponding to the HeaderSection
element. HORIZONTAL_RULE
Enum
The type corresponding to the HorizontalRule
element. INLINE_DRAWING
Enum
The type corresponding to the InlineDrawing
element. INLINE_IMAGE
Enum
The type corresponding to the InlineImage
element. LIST_ITEM
Enum
The type corresponding to the ListItem
element. PAGE_BREAK
Enum
The type corresponding to the PageBreak
element. PARAGRAPH
Enum
The type corresponding to the Paragraph
element. PERSON
Enum
The type corresponding to the Person
element. TABLE
Enum
The type corresponding to the Table
element. TABLE_CELL
Enum
The type corresponding to the TableCell
element. TABLE_OF_CONTENTS
Enum
The type corresponding to the TableOfContents
element. TABLE_ROW
Enum
The type corresponding to the TableRow
element. TEXT
Enum
The type corresponding to the Text
element. UNSUPPORTED
Enum
The type corresponding to UnsupportedElement
. Unsupported elements represent document portions that do not support scripting.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-03 UTC."],[[["`ElementType` is an enumeration used to identify the type of elements within a Google Doc."],["You can access `ElementType` properties using the format `DocumentApp.ElementType.PROPERTY_NAME`, such as `DocumentApp.ElementType.PARAGRAPH`."],["The `getType()` method can be used to determine the type of a specific element, enabling conditional logic based on element types."],["`ElementType` supports a wide range of element types like paragraphs, tables, images, equations, and more, as detailed in the provided properties table."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4