Enum ElementType
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
ElementTyp
Eine Aufzählung aller Elementtypen.
Wenn Sie ein Enum aufrufen möchten, rufen Sie die übergeordnete Klasse, den Namen und die Eigenschaft auf. Beispiel:
DocumentApp.ElementType.BODY_SECTION
.
Mit der Aufzählung ElementType
können Sie den Typ eines bestimmten Elements prüfen, z. B.:
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);
}
Attribute
Attribut | Typ | Beschreibung |
BODY_SECTION | Enum | Der Typ, der dem Body -Element entspricht. |
COMMENT_SECTION | Enum | Der Typ, der dem CommentSection -Element entspricht. |
DATE | Enum | Der Typ, der dem Date -Element entspricht. |
EQUATION | Enum | Der Typ, der dem Equation -Element entspricht. |
EQUATION_FUNCTION | Enum | Der Typ, der dem EquationFunction -Element entspricht. |
EQUATION_FUNCTION_ARGUMENT_SEPARATOR | Enum | Der Typ, der dem EquationFunctionArgumentSeparator -Element entspricht. |
EQUATION_SYMBOL | Enum | Der Typ, der dem EquationSymbol -Element entspricht. |
RICH_LINK | Enum | Der Typ, der dem RichLink -Element entspricht. |
FOOTER_SECTION | Enum | Der Typ, der dem FooterSection -Element entspricht. |
FOOTNOTE | Enum | Der Typ, der dem Footnote -Element entspricht. |
FOOTNOTE_SECTION | Enum | Der Typ, der dem FootnoteSection -Element entspricht. |
HEADER_SECTION | Enum | Der Typ, der dem HeaderSection -Element entspricht. |
HORIZONTAL_RULE | Enum | Der Typ, der dem HorizontalRule -Element entspricht. |
INLINE_DRAWING | Enum | Der Typ, der dem InlineDrawing -Element entspricht. |
INLINE_IMAGE | Enum | Der Typ, der dem InlineImage -Element entspricht. |
LIST_ITEM | Enum | Der Typ, der dem ListItem -Element entspricht. |
PAGE_BREAK | Enum | Der Typ, der dem PageBreak -Element entspricht. |
PARAGRAPH | Enum | Der Typ, der dem Paragraph -Element entspricht. |
PERSON | Enum | Der Typ, der dem Person -Element entspricht. |
TABLE | Enum | Der Typ, der dem Table -Element entspricht. |
TABLE_CELL | Enum | Der Typ, der dem TableCell -Element entspricht. |
TABLE_OF_CONTENTS | Enum | Der Typ, der dem TableOfContents -Element entspricht. |
TABLE_ROW | Enum | Der Typ, der dem TableRow -Element entspricht. |
TEXT | Enum | Der Typ, der dem Text -Element entspricht. |
UNSUPPORTED | Enum | Der Typ, der UnsupportedElement entspricht. Nicht unterstützte Elemente stellen Dokumentteile dar, die kein Scripting unterstützen. |
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eElementType\u003c/code\u003e is an enumeration used to identify the type of elements within a Google Doc.\u003c/p\u003e\n"],["\u003cp\u003eYou can access \u003ccode\u003eElementType\u003c/code\u003e properties using the format \u003ccode\u003eDocumentApp.ElementType.PROPERTY_NAME\u003c/code\u003e, such as \u003ccode\u003eDocumentApp.ElementType.PARAGRAPH\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetType()\u003c/code\u003e method can be used to determine the type of a specific element, enabling conditional logic based on element types.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eElementType\u003c/code\u003e supports a wide range of element types like paragraphs, tables, images, equations, and more, as detailed in the provided properties table.\u003c/p\u003e\n"]]],[],null,["# Enum ElementType\n\nElementType\n\nAn enumeration of all the element types.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nDocumentApp.ElementType.BODY_SECTION`.\n\nUse the [ElementType](#) enumeration to check the type of a given element, for instance:\n\n```javascript\nconst documentTab =\n DocumentApp.getActiveDocument().getActiveTab().asDocumentTab();\nconst firstChild = documentTab.getBody().getChild(0);\nif (firstChild.getType() === DocumentApp.ElementType.PARAGRAPH) {\n // It's a paragraph, apply a paragraph heading.\n firstChild.asParagraph().setHeading(DocumentApp.ParagraphHeading.HEADING1);\n}\n``` \n\n### Properties\n\n| Property | Type | Description |\n|----------------------------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `BODY_SECTION` | `Enum` | The type corresponding to the [Body](/apps-script/reference/document/body) element. |\n| `COMMENT_SECTION` | `Enum` | The type corresponding to the CommentSection element. |\n| `DATE` | `Enum` | The type corresponding to the [Date](/apps-script/reference/document/date) element. |\n| `EQUATION` | `Enum` | The type corresponding to the [Equation](/apps-script/reference/document/equation) element. |\n| `EQUATION_FUNCTION` | `Enum` | The type corresponding to the [EquationFunction](/apps-script/reference/document/equation-function) element. |\n| `EQUATION_FUNCTION_ARGUMENT_SEPARATOR` | `Enum` | The type corresponding to the [EquationFunctionArgumentSeparator](/apps-script/reference/document/equation-function-argument-separator) element. |\n| `EQUATION_SYMBOL` | `Enum` | The type corresponding to the [EquationSymbol](/apps-script/reference/document/equation-symbol) element. |\n| `RICH_LINK` | `Enum` | The type corresponding to the [RichLink](/apps-script/reference/document/rich-link) element. |\n| `FOOTER_SECTION` | `Enum` | The type corresponding to the [FooterSection](/apps-script/reference/document/footer-section) element. |\n| `FOOTNOTE` | `Enum` | The type corresponding to the [Footnote](/apps-script/reference/document/footnote) element. |\n| `FOOTNOTE_SECTION` | `Enum` | The type corresponding to the [FootnoteSection](/apps-script/reference/document/footnote-section) element. |\n| `HEADER_SECTION` | `Enum` | The type corresponding to the [HeaderSection](/apps-script/reference/document/header-section) element. |\n| `HORIZONTAL_RULE` | `Enum` | The type corresponding to the [HorizontalRule](/apps-script/reference/document/horizontal-rule) element. |\n| `INLINE_DRAWING` | `Enum` | The type corresponding to the [InlineDrawing](/apps-script/reference/document/inline-drawing) element. |\n| `INLINE_IMAGE` | `Enum` | The type corresponding to the [InlineImage](/apps-script/reference/document/inline-image) element. |\n| `LIST_ITEM` | `Enum` | The type corresponding to the [ListItem](/apps-script/reference/document/list-item) element. |\n| `PAGE_BREAK` | `Enum` | The type corresponding to the [PageBreak](/apps-script/reference/document/page-break) element. |\n| `PARAGRAPH` | `Enum` | The type corresponding to the [Paragraph](/apps-script/reference/document/paragraph) element. |\n| `PERSON` | `Enum` | The type corresponding to the [Person](/apps-script/reference/document/person) element. |\n| `TABLE` | `Enum` | The type corresponding to the [Table](/apps-script/reference/document/table) element. |\n| `TABLE_CELL` | `Enum` | The type corresponding to the [TableCell](/apps-script/reference/document/table-cell) element. |\n| `TABLE_OF_CONTENTS` | `Enum` | The type corresponding to the [TableOfContents](/apps-script/reference/document/table-of-contents) element. |\n| `TABLE_ROW` | `Enum` | The type corresponding to the [TableRow](/apps-script/reference/document/table-row) element. |\n| `TEXT` | `Enum` | The type corresponding to the [Text](/apps-script/reference/document/text) element. |\n| `UNSUPPORTED` | `Enum` | The type corresponding to [UnsupportedElement](/apps-script/reference/document/unsupported-element). Unsupported elements represent document portions that do not support scripting. |"]]