Enum Attribute
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Atrybut
Wyliczenie atrybutów elementu.
Aby wywołać enum, wywołaj jego klasę nadrzędną, nazwę i właściwość. Na przykład:
DocumentApp.Attribute.BACKGROUND_COLOR
.
Używaj atrybutów do tworzenia stylów niestandardowych. Na przykład:
// Define a style with yellow background.
const highlightStyle = {};
highlightStyle[DocumentApp.Attribute.BACKGROUND_COLOR] = '#FFFF00';
highlightStyle[DocumentApp.Attribute.BOLD] = true;
// Insert "Hello", highlighted.
DocumentApp.getActiveDocument()
.getActiveTab()
.asDocumentTab()
.editAsText()
.insertText(0, 'Hello\n')
.setAttributes(0, 4, highlightStyle);
Właściwości
Właściwość | Typ | Opis |
BACKGROUND_COLOR | Enum | Kolor tła elementu (akapit, tabela itp.) lub dokumentu. |
BOLD | Enum | Ustawienie grubości czcionki dla tekstu sformatowanego. |
BORDER_COLOR | Enum | Kolor obramowania elementów tabeli. |
BORDER_WIDTH | Enum | Szerokość obramowania w punktach dla elementów tabeli. |
CODE | Enum | Treść kodu dla elementów równań. |
FONT_FAMILY | Enum | Ustawienie rodziny czcionek dla tekstu zwykłego. |
FONT_SIZE | Enum | Ustawienie rozmiaru czcionki w punktach w przypadku tekstu sformatowanego. |
FOREGROUND_COLOR | Enum | Ustawienie koloru pierwszego planu dla tekstu multimedialnego. |
HEADING | Enum | Typ nagłówka w przypadku elementów akapitu (np. DocumentApp.ParagraphHeading.HEADING1 ). |
HEIGHT | Enum | Ustawienie wysokości elementów obrazu. |
HORIZONTAL_ALIGNMENT | Enum | Wyrównanie poziome elementów akapitu (np. DocumentApp.HorizontalAlignment.CENTER ). |
INDENT_END | Enum | Ustawienie wcięcia końca w punktach dla elementów akapitu. |
INDENT_FIRST_LINE | Enum | Ustawienie wcięcia pierwszego wiersza w elementach akapitu w punktach. |
INDENT_START | Enum | Ustawienie wcięcia początkowego w punktach w przypadku elementów akapitu. |
ITALIC | Enum | Ustawienie stylu czcionki dla tekstu sformatowanego. |
GLYPH_TYPE | Enum | Typ glifów dla elementów elementów listy. |
LEFT_TO_RIGHT | Enum | Ustawienie kierunku tekstu w przypadku tekstu sformatowanego. |
LINE_SPACING | Enum | Ustawienie odstępów między wierszami jako mnożnik w przypadku elementów akapitu. |
LINK_URL | Enum | Adres URL linku do tekstu rozszerzonego. Domyślny styl linku (kolor pierwszego planu, podkreślenie) jest stosowany automatycznie. |
LIST_ID | Enum | Identyfikator obejmującej listy w przypadku elementów listy produktów. |
MARGIN_BOTTOM | Enum | Ustawienie dolnego marginesu w punktach w przypadku elementów akapitu. |
MARGIN_LEFT | Enum | Ustawienie lewego marginesu w punktach w przypadku elementów akapitu. |
MARGIN_RIGHT | Enum | Ustawienie prawego marginesu w elementach akapitu w punktach. |
MARGIN_TOP | Enum | Ustawienie górnego marginesu w punktach w przypadku elementów akapitu. |
NESTING_LEVEL | Enum | Poziom zagnieżdżenia elementu w przypadku elementów pozycji listy. |
MINIMUM_HEIGHT | Enum | Minimalna wysokość w punktach dla elementów wiersza tabeli. |
PADDING_BOTTOM | Enum | Ustawienie dopełnienia dolnego w elementach komórek tabeli w punktach. |
PADDING_LEFT | Enum | Ustawienie wypełnienia lewego marginesu w punktach dla elementów komórek tabeli. |
PADDING_RIGHT | Enum | Ustawienie wyrównania prawej strony w punktach dla elementów komórek tabeli. |
PADDING_TOP | Enum | Ustawienie wypełnienia górnego w punktach dla elementów komórek tabeli. |
PAGE_HEIGHT | Enum | Ustawienie wysokości strony w punktach w przypadku dokumentów. |
PAGE_WIDTH | Enum | Ustawienie szerokości strony w punktach w przypadku dokumentów. |
SPACING_AFTER | Enum | Ustawienie odstępu od dołu w punktach dla elementów akapitu. |
SPACING_BEFORE | Enum | Ustawienie odstępu górnego w punktach w przypadku elementów akapitu. |
STRIKETHROUGH | Enum | Ustawienie przekreślenia w przypadku tekstu sformatowanego. |
UNDERLINE | Enum | Ustawienie podkreślenia dla tekstu sformatowanego. |
VERTICAL_ALIGNMENT | Enum | Ustawienie wyrównania w pionie elementów komórek tabeli. |
WIDTH | Enum | Ustawienie szerokości dla komórek tabeli i elementów obrazu. |
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eDocumentApp.Attribute\u003c/code\u003e enumerates element attributes that can be used to define custom styles for Google Docs elements.\u003c/p\u003e\n"],["\u003cp\u003eAttributes are accessed by calling the parent class, name, and property such as \u003ccode\u003eDocumentApp.Attribute.BACKGROUND_COLOR\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can apply custom styles to elements within a Google Doc by defining a style object and setting attributes like background color, font weight, etc.\u003c/p\u003e\n"],["\u003cp\u003eA comprehensive list of available attributes and their descriptions is provided to allow detailed element styling.\u003c/p\u003e\n"]]],[],null,["# Enum Attribute\n\nAttribute\n\nAn enumeration of the element attributes.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nDocumentApp.Attribute.BACKGROUND_COLOR`.\n\nUse attributes to compose custom styles. For example:\n\n```javascript\n// Define a style with yellow background.\nconst highlightStyle = {};\nhighlightStyle[DocumentApp.Attribute.BACKGROUND_COLOR] = '#FFFF00';\nhighlightStyle[DocumentApp.Attribute.BOLD] = true;\n\n// Insert \"Hello\", highlighted.\nDocumentApp.getActiveDocument()\n .getActiveTab()\n .asDocumentTab()\n .editAsText()\n .insertText(0, 'Hello\\n')\n .setAttributes(0, 4, highlightStyle);\n``` \n\n### Properties\n\n| Property | Type | Description |\n|------------------------|--------|-------------------------------------------------------------------------------------------------------------|\n| `BACKGROUND_COLOR` | `Enum` | The background color of an element (Paragraph, Table, etc) or document. |\n| `BOLD` | `Enum` | The font weight setting, for rich text. |\n| `BORDER_COLOR` | `Enum` | The border color, for table elements. |\n| `BORDER_WIDTH` | `Enum` | The border width in points, for table elements. |\n| `CODE` | `Enum` | The code contents, for equation elements. |\n| `FONT_FAMILY` | `Enum` | The font family setting, for rich text. |\n| `FONT_SIZE` | `Enum` | The font size setting in points, for rich text. |\n| `FOREGROUND_COLOR` | `Enum` | The foreground color setting, for rich text. |\n| `HEADING` | `Enum` | The heading type, for paragraph elements (for example, `Document``App.ParagraphHeading.HEADING1`). |\n| `HEIGHT` | `Enum` | The height setting, for image elements. |\n| `HORIZONTAL_ALIGNMENT` | `Enum` | The horizontal alignment, for paragraph elements (for example, `Document``App.HorizontalAlignment.CENTER`). |\n| `INDENT_END` | `Enum` | The end indentation setting in points, for paragraph elements. |\n| `INDENT_FIRST_LINE` | `Enum` | The first line indentation setting in points, for paragraph elements. |\n| `INDENT_START` | `Enum` | The start indentation setting in points, for paragraph elements. |\n| `ITALIC` | `Enum` | The font style setting, for rich text. |\n| `GLYPH_TYPE` | `Enum` | The glyph type, for list item elements. |\n| `LEFT_TO_RIGHT` | `Enum` | The text direction setting, for rich text. |\n| `LINE_SPACING` | `Enum` | The line spacing setting as a multiplier, for paragraph elements. |\n| `LINK_URL` | `Enum` | The link URL, for rich text. The default link style (foreground color, underline) is automatically applied. |\n| `LIST_ID` | `Enum` | The ID of the encompassing list, for list item elements. |\n| `MARGIN_BOTTOM` | `Enum` | The bottom margin setting in points, for paragraph elements. |\n| `MARGIN_LEFT` | `Enum` | The left margin setting in points, for paragraph elements. |\n| `MARGIN_RIGHT` | `Enum` | The right margin setting in points, for paragraph elements. |\n| `MARGIN_TOP` | `Enum` | The top margin setting in points, for paragraph elements. |\n| `NESTING_LEVEL` | `Enum` | The item nesting level, for list item elements. |\n| `MINIMUM_HEIGHT` | `Enum` | The minimum height setting in points, for table row elements. |\n| `PADDING_BOTTOM` | `Enum` | The bottom padding setting in points, for table cell elements. |\n| `PADDING_LEFT` | `Enum` | The left padding setting in points, for table cell elements. |\n| `PADDING_RIGHT` | `Enum` | The right padding setting in points, for table cell elements. |\n| `PADDING_TOP` | `Enum` | The top padding setting in points, for table cell elements. |\n| `PAGE_HEIGHT` | `Enum` | The page height setting in points, for documents. |\n| `PAGE_WIDTH` | `Enum` | The page width setting in points, for documents. |\n| `SPACING_AFTER` | `Enum` | The bottom spacing setting in points, for paragraph elements. |\n| `SPACING_BEFORE` | `Enum` | The top spacing setting in points, for paragraph elements. |\n| `STRIKETHROUGH` | `Enum` | The strike-through setting, for rich text. |\n| `UNDERLINE` | `Enum` | The underline setting, for rich text. |\n| `VERTICAL_ALIGNMENT` | `Enum` | The vertical alignment setting, for table cell elements. |\n| `WIDTH` | `Enum` | The width setting, for table cell and image elements. |"]]