Enum ElementType

  • ElementType is an enumeration listing all possible element types in a document.

  • You access ElementType enum values using the parent class, name, and property likeDocumentApp.ElementType.BODY_SECTION.

  • ElementType can be used to check the type of a specific element in a document, as shown in the provided code example.

  • The table lists various ElementType properties and their corresponding document elements.

ElementType

An 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 theElementType enumeration to check the type of a given element, for instance:

constdocumentTab=DocumentApp.getActiveDocument().getActiveTab().asDocumentTab();constfirstChild=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

PropertyTypeDescription
BODY_SECTIONEnumThe type corresponding to theBody element.
COMMENT_SECTIONEnumThe type corresponding to theCommentSection element.
DATEEnumThe type corresponding to theDateelement.
EQUATIONEnumThe type corresponding to theEquation element.
EQUATION_FUNCTIONEnumThe type corresponding to theEquationFunction element.
EQUATION_FUNCTION_ARGUMENT_SEPARATOREnumThe type corresponding to theEquationFunctionArgumentSeparatorelement.
EQUATION_SYMBOLEnumThe type corresponding to theEquationSymbol element.
RICH_LINKEnumThe type corresponding to theRichLink element.
FOOTER_SECTIONEnumThe type corresponding to theFooterSection element.
FOOTNOTEEnumThe type corresponding to theFootnote element.
FOOTNOTE_SECTIONEnumThe type corresponding to theFootnoteSection element.
HEADER_SECTIONEnumThe type corresponding to theHeaderSection element.
HORIZONTAL_RULEEnumThe type corresponding to theHorizontalRule element.
INLINE_DRAWINGEnumThe type corresponding to theInlineDrawing element.
INLINE_IMAGEEnumThe type corresponding to theInlineImage element.
LIST_ITEMEnumThe type corresponding to theListItem element.
PAGE_BREAKEnumThe type corresponding to thePageBreak element.
PARAGRAPHEnumThe type corresponding to theParagraph element.
PERSONEnumThe type corresponding to thePerson element.
TABLEEnumThe type corresponding to theTable element.
TABLE_CELLEnumThe type corresponding to theTableCell element.
TABLE_OF_CONTENTSEnumThe type corresponding to theTableOfContents element.
TABLE_ROWEnumThe type corresponding to theTableRow element.
TEXTEnumThe type corresponding to theTextelement.
UNSUPPORTEDEnumThe type corresponding toUnsupportedElement. Unsupported elementsrepresent document portions that do not support scripting.

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.