Enum ElementType

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

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

PropertyTypeDescription
BODY_SECTIONEnumThe type corresponding to the Body element.
COMMENT_SECTIONEnumThe type corresponding to the CommentSection element.
DATEEnumThe type corresponding to the Date element.
EQUATIONEnumThe type corresponding to the Equation element.
EQUATION_FUNCTIONEnumThe type corresponding to the EquationFunction element.
EQUATION_FUNCTION_ARGUMENT_SEPARATOREnumThe type corresponding to the EquationFunctionArgumentSeparator element.
EQUATION_SYMBOLEnumThe type corresponding to the EquationSymbol element.
RICH_LINKEnumThe type corresponding to the RichLink element.
FOOTER_SECTIONEnumThe type corresponding to the FooterSection element.
FOOTNOTEEnumThe type corresponding to the Footnote element.
FOOTNOTE_SECTIONEnumThe type corresponding to the FootnoteSection element.
HEADER_SECTIONEnumThe type corresponding to the HeaderSection element.
HORIZONTAL_RULEEnumThe type corresponding to the HorizontalRule element.
INLINE_DRAWINGEnumThe type corresponding to the InlineDrawing element.
INLINE_IMAGEEnumThe type corresponding to the InlineImage element.
LIST_ITEMEnumThe type corresponding to the ListItem element.
PAGE_BREAKEnumThe type corresponding to the PageBreak element.
PARAGRAPHEnumThe type corresponding to the Paragraph element.
PERSONEnumThe type corresponding to the Person element.
TABLEEnumThe type corresponding to the Table element.
TABLE_CELLEnumThe type corresponding to the TableCell element.
TABLE_OF_CONTENTSEnumThe type corresponding to the TableOfContents element.
TABLE_ROWEnumThe type corresponding to the TableRow element.
TEXTEnumThe type corresponding to the Text element.
UNSUPPORTEDEnumThe type corresponding to UnsupportedElement. Unsupported elements represent document portions that do not support scripting.