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_SECTIONEnumBody 元素對應的型別。
COMMENT_SECTIONEnumCommentSection 元素對應的型別。
DATEEnumDate 元素對應的型別。
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 元素對應的型別。
UNSUPPORTEDEnum對應 UnsupportedElement 的型別。不支援的元素代表文件部分內容不支援指令碼。