Enum ElementType

ElementType

枚举所有元素类型。

若要调用枚举,您可以调用其父类、名称和属性。例如 DocumentApp.ElementType.BODY_SECTION

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

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

属性

媒体资源类型说明
BODY_SECTIONEnumBody 元素对应的类型。
COMMENT_SECTIONEnumCommentSection 元素对应的类型。
DATEEnumDate 元素对应的类型。
DOCUMENTEnum与文档根目录对应的类型。
EQUATIONEnumEquation 元素对应的类型。
EQUATION_FUNCTIONEnumEquationFunction 元素对应的类型。
EQUATION_FUNCTION_ARGUMENT_SEPARATOREnumEquationFunctionArgumentSeparator 元素对应的类型。
EQUATION_SYMBOLEnumEquationSymbol 元素对应的类型。
RICH_LINKEnumRichLink 元素对应的类型。
FOOTER_SECTIONEnumFooterSection 元素对应的类型。
FOOTNOTEEnumFootnote 元素对应的类型。
FOOTNOTE_SECTIONEnumFootnoteSection 元素对应的类型。
HEADER_SECTIONEnumHeaderSection 元素对应的类型。
HORIZONTAL_RULEEnumHorizontalRule 元素对应的类型。
INLINE_DRAWINGEnumInlineDrawing 元素对应的类型。
INLINE_IMAGEEnumInlineImage 元素对应的类型。
LIST_ITEMEnumListItem 元素对应的类型。
PAGE_BREAKEnumPageBreak 元素对应的类型。
PARAGRAPHEnumParagraph 元素对应的类型。
PERSONEnumPerson 元素对应的类型。
TABLEEnumTable 元素对应的类型。
TABLE_CELLEnumTableCell 元素对应的类型。
TABLE_OF_CONTENTSEnumTableOfContents 元素对应的类型。
TABLE_ROWEnumTableRow 元素对应的类型。
TEXTEnumText 元素对应的类型。
UNSUPPORTEDEnumUnsupportedElement 对应的类型。不受支持的元素表示不支持脚本的文档部分。