An enumeration of the element attributes.
To call an enum, you call its parent class, name, and property. For example,
DocumentApp.Attribute.BACKGROUND_COLOR
.
Use attributes to compose custom styles. For example:
// Define a style with yellow background. var 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);
Properties
Property | Type | Description |
---|---|---|
BACKGROUND_COLOR | Enum | The background color of an element (Paragraph, Table, etc) or document. |
BOLD | Enum | The font weight setting, for rich text. |
BORDER_COLOR | Enum | The border color, for table elements. |
BORDER_WIDTH | Enum | The border width in points, for table elements. |
CODE | Enum | The code contents, for equation elements. |
FONT_FAMILY | Enum | The font family setting, for rich text. |
FONT_SIZE | Enum | The font size setting in points, for rich text. |
FOREGROUND_COLOR | Enum | The foreground color setting, for rich text. |
HEADING | Enum | The heading type, for paragraph elements (for example, DocumentApp.ParagraphHeading.HEADING1 ). |
HEIGHT | Enum | The height setting, for image elements. |
HORIZONTAL_ALIGNMENT | Enum | The horizontal alignment, for paragraph elements (for example, DocumentApp.HorizontalAlignment.CENTER ). |
INDENT_END | Enum | The end indentation setting in points, for paragraph elements. |
INDENT_FIRST_LINE | Enum | The first line indentation setting in points, for paragraph elements. |
INDENT_START | Enum | The start indentation setting in points, for paragraph elements. |
ITALIC | Enum | The font style setting, for rich text. |
GLYPH_TYPE | Enum | The glyph type, for list item elements. |
LEFT_TO_RIGHT | Enum | The text direction setting, for rich text. |
LINE_SPACING | Enum | The line spacing setting as a multiplier, for paragraph elements. |
LINK_URL | Enum | The link URL, for rich text. The default link style (foreground color, underline) is automatically applied. |
LIST_ID | Enum | The ID of the encompassing list, for list item elements. |
MARGIN_BOTTOM | Enum | The bottom margin setting in points, for paragraph elements. |
MARGIN_LEFT | Enum | The left margin setting in points, for paragraph elements. |
MARGIN_RIGHT | Enum | The right margin setting in points, for paragraph elements. |
MARGIN_TOP | Enum | The top margin setting in points, for paragraph elements. |
NESTING_LEVEL | Enum | The item nesting level, for list item elements. |
MINIMUM_HEIGHT | Enum | The minimum height setting in points, for table row elements. |
PADDING_BOTTOM | Enum | The bottom padding setting in points, for table cell elements. |
PADDING_LEFT | Enum | The left padding setting in points, for table cell elements. |
PADDING_RIGHT | Enum | The right padding setting in points, for table cell elements. |
PADDING_TOP | Enum | The top padding setting in points, for table cell elements. |
PAGE_HEIGHT | Enum | The page height setting in points, for documents. |
PAGE_WIDTH | Enum | The page width setting in points, for documents. |
SPACING_AFTER | Enum | The bottom spacing setting in points, for paragraph elements. |
SPACING_BEFORE | Enum | The top spacing setting in points, for paragraph elements. |
STRIKETHROUGH | Enum | The strike-through setting, for rich text. |
UNDERLINE | Enum | The underline setting, for rich text. |
VERTICAL_ALIGNMENT | Enum | The vertical alignment setting, for table cell elements. |
WIDTH | Enum | The width setting, for table cell and image elements. |