Enum ElementType

ElementType

所有元素类型的枚举。

如需调用枚举,请调用其父类、名称和属性。例如, DocumentApp.ElementType.BODY_SECTION。

使用 ElementType 枚举检查给定元素的类型,例如:

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);
}

属性

属性类型说明
BODY_SECTIONEnum与 Body 元素对应的类型。
COMMENT_SECTIONEnum与 CommentSection 元素对应的类型。
DATEEnum与 Date 元素对应的类型。
EQUATIONEnum与 Equation 元素对应的类型。
EQUATION_FUNCTIONEnum与 EquationFunction 元素对应的类型。
EQUATION_FUNCTION_ARGUMENT_SEPARATOREnum与 EquationFunctionArgumentSeparator 元素对应的类型。
EQUATION_SYMBOLEnum与 EquationSymbol 元素对应的类型。
RICH_LINKEnum与 RichLink 元素对应的类型。
FOOTER_SECTIONEnum与 FooterSection 元素对应的类型。
FOOTNOTEEnum与 Footnote 元素对应的类型。
FOOTNOTE_SECTIONEnum与 FootnoteSection 元素对应的类型。
HEADER_SECTIONEnum与 HeaderSection 元素对应的类型。
HORIZONTAL_RULEEnum与 HorizontalRule 元素对应的类型。
INLINE_DRAWINGEnum与 InlineDrawing 元素对应的类型。
INLINE_IMAGEEnum与 InlineImage 元素对应的类型。
LIST_ITEMEnum与 ListItem 元素对应的类型。
PAGE_BREAKEnum与 PageBreak 元素对应的类型。
PARAGRAPHEnum与 Paragraph 元素对应的类型。
PERSONEnum与 Person 元素对应的类型。
TABLEEnum与 Table 元素对应的类型。
TABLE_CELLEnum与 TableCell 元素对应的类型。
TABLE_OF_CONTENTSEnum与 TableOfContents 元素对应的类型。
TABLE_ROWEnum与 TableRow 元素对应的类型。
TEXTEnum与 Text 元素对应的类型。
UNSUPPORTEDEnum与 UnsupportedElement 对应的类型。不受支持的元素表示不支持脚本的文档部分。