Google Apps Script

Enum ElementType

An enumeration of all the element types.

Use the ElementType enumeration to check the type of a given element, for instance:

 
var firstChild = DocumentApp.getActiveDocument().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.
DOCUMENTEnumThe type that corresponds to the root of the document.
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.
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.
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.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.