Text

TextContent

The general text content. The text must reside in a compatible shape (e.g. text box or rectangle) or a table cell in a page.

JSON representation
{
  "textElements": [
    {
      object (TextElement)
    }
  ],
  "lists": {
    string: {
      object (List)
    },
    ...
  }
}
Fields
textElements[]

object (TextElement)

The text contents broken down into its component parts, including styling information. This property is read-only.

lists

map (key: string, value: object ( List))

The bulleted lists contained in this text, keyed by list ID.

TextElement

A TextElement describes the content of a range of indices in the text content of a Shape or TableCell.

JSON representation
{
  "startIndex": integer,
  "endIndex": integer,

  // Union field kind can be only one of the following:
  "paragraphMarker": {
    object (ParagraphMarker)
  },
  "textRun": {
    object (TextRun)
  },
  "autoText": {
    object (AutoText)
  }
  // End of list of possible types for union field kind.
}
Fields
startIndex

integer

The zero-based start index of this text element, in Unicode code units.

endIndex

integer

The zero-based end index of this text element, exclusive, in Unicode code units.

Union field kind. The kind of text that this element represents. kind can be only one of the following:
paragraphMarker

object (ParagraphMarker)

A marker representing the beginning of a new paragraph.

The startIndex and endIndex of this TextElement represent the range of the paragraph. Other TextElements with an index range contained inside this paragraph's range are considered to be part of this paragraph. The range of indices of two separate paragraphs will never overlap.

textRun

object (TextRun)

A TextElement representing a run of text where all of the characters in the run have the same TextStyle.

The startIndex and endIndex of TextRuns will always be fully contained in the index range of a single paragraphMarker TextElement. In other words, a TextRun will never span multiple paragraphs.

autoText

object (AutoText)

A TextElement representing a spot in the text that is dynamically replaced with content that can change over time.

ParagraphMarker

A TextElement kind that represents the beginning of a new paragraph.

JSON representation
{
  "style": {
    object (ParagraphStyle)
  },
  "bullet": {
    object (Bullet)
  }
}
Fields
style

object (ParagraphStyle)

The paragraph's style

bullet

object (Bullet)

The bullet for this paragraph. If not present, the paragraph does not belong to a list.

ParagraphStyle

Styles that apply to a whole paragraph.

If this text is contained in a shape with a parent placeholder, then these paragraph styles may be inherited from the parent. Which paragraph styles are inherited depend on the nesting level of lists:

  • A paragraph not in a list will inherit its paragraph style from the paragraph at the 0 nesting level of the list inside the parent placeholder.
  • A paragraph in a list will inherit its paragraph style from the paragraph at its corresponding nesting level of the list inside the parent placeholder.

Inherited paragraph styles are represented as unset fields in this message.

JSON representation
{
  "lineSpacing": number,
  "alignment": enum (Alignment),
  "indentStart": {
    object (Dimension)
  },
  "indentEnd": {
    object (Dimension)
  },
  "spaceAbove": {
    object (Dimension)
  },
  "spaceBelow": {
    object (Dimension)
  },
  "indentFirstLine": {
    object (Dimension)
  },
  "direction": enum (TextDirection),
  "spacingMode": enum (SpacingMode)
}
Fields
lineSpacing

number

The amount of space between lines, as a percentage of normal, where normal is represented as 100.0. If unset, the value is inherited from the parent.

alignment

enum (Alignment)

The text alignment for this paragraph.

indentStart

object (Dimension)

The amount indentation for the paragraph on the side that corresponds to the start of the text, based on the current text direction. If unset, the value is inherited from the parent.

indentEnd

object (Dimension)

The amount indentation for the paragraph on the side that corresponds to the end of the text, based on the current text direction. If unset, the value is inherited from the parent.

spaceAbove

object (Dimension)

The amount of extra space above the paragraph. If unset, the value is inherited from the parent.

spaceBelow

object (Dimension)

The amount of extra space below the paragraph. If unset, the value is inherited from the parent.

indentFirstLine

object (Dimension)

The amount of indentation for the start of the first line of the paragraph. If unset, the value is inherited from the parent.

direction

enum (TextDirection)

The text direction of this paragraph. If unset, the value defaults to LEFT_TO_RIGHT since text direction is not inherited.

spacingMode

enum (SpacingMode)

The spacing mode for the paragraph.

Alignment

The types of text alignment for a paragraph.

Enums
ALIGNMENT_UNSPECIFIED The paragraph alignment is inherited from the parent.
START The paragraph is aligned to the start of the line. Left-aligned for LTR text, right-aligned otherwise.
CENTER The paragraph is centered.
END The paragraph is aligned to the end of the line. Right-aligned for LTR text, left-aligned otherwise.
JUSTIFIED The paragraph is justified.

TextDirection

The directions text can flow in.

Enums
TEXT_DIRECTION_UNSPECIFIED The text direction is inherited from the parent.
LEFT_TO_RIGHT The text goes from left to right.
RIGHT_TO_LEFT The text goes from right to left.

SpacingMode

The different modes for paragraph spacing.

Enums
SPACING_MODE_UNSPECIFIED The spacing mode is inherited from the parent.
NEVER_COLLAPSE Paragraph spacing is always rendered.
COLLAPSE_LISTS Paragraph spacing is skipped between list elements.

Bullet

Describes the bullet of a paragraph.

JSON representation
{
  "listId": string,
  "nestingLevel": integer,
  "glyph": string,
  "bulletStyle": {
    object (TextStyle)
  }
}
Fields
listId

string

The ID of the list this paragraph belongs to.

nestingLevel

integer

The nesting level of this paragraph in the list.

glyph

string

The rendered bullet glyph for this paragraph.

bulletStyle

object (TextStyle)

The paragraph specific text style applied to this bullet.

TextStyle

Represents the styling that can be applied to a TextRun.

If this text is contained in a shape with a parent placeholder, then these text styles may be inherited from the parent. Which text styles are inherited depend on the nesting level of lists:

  • A text run in a paragraph that is not in a list will inherit its text style from the the newline character in the paragraph at the 0 nesting level of the list inside the parent placeholder.
  • A text run in a paragraph that is in a list will inherit its text style from the newline character in the paragraph at its corresponding nesting level of the list inside the parent placeholder.

Inherited text styles are represented as unset fields in this message. If text is contained in a shape without a parent placeholder, unsetting these fields will revert the style to a value matching the defaults in the Slides editor.

JSON representation
{
  "backgroundColor": {
    object (OptionalColor)
  },
  "foregroundColor": {
    object (OptionalColor)
  },
  "bold": boolean,
  "italic": boolean,
  "fontFamily": string,
  "fontSize": {
    object (Dimension)
  },
  "link": {
    object (Link)
  },
  "baselineOffset": enum (BaselineOffset),
  "smallCaps": boolean,
  "strikethrough": boolean,
  "underline": boolean,
  "weightedFontFamily": {
    object (WeightedFontFamily)
  }
}
Fields
backgroundColor

object (OptionalColor)

The background color of the text. If set, the color is either opaque or transparent, depending on if the opaqueColor field in it is set.

foregroundColor

object (OptionalColor)

The color of the text itself. If set, the color is either opaque or transparent, depending on if the opaqueColor field in it is set.

bold

boolean

Whether or not the text is rendered as bold.

italic

boolean

Whether or not the text is italicized.

fontFamily

string

The font family of the text.

The font family can be any font from the Font menu in Slides or from Google Fonts. If the font name is unrecognized, the text is rendered in Arial.

Some fonts can affect the weight of the text. If an update request specifies values for both fontFamily and bold, the explicitly-set bold value is used.

fontSize

object (Dimension)

The size of the text's font. When read, the fontSize will specified in points.

baselineOffset

enum (BaselineOffset)

The text's vertical offset from its normal position.

Text with SUPERSCRIPT or SUBSCRIPT baseline offsets is automatically rendered in a smaller font size, computed based on the fontSize field. The fontSize itself is not affected by changes in this field.

smallCaps

boolean

Whether or not the text is in small capital letters.

strikethrough

boolean

Whether or not the text is struck through.

underline

boolean

Whether or not the text is underlined.

weightedFontFamily

object (WeightedFontFamily)

The font family and rendered weight of the text.

This field is an extension of fontFamily meant to support explicit font weights without breaking backwards compatibility. As such, when reading the style of a range of text, the value of weightedFontFamily#fontFamily will always be equal to that of fontFamily. However, when writing, if both fields are included in the field mask (either explicitly or through the wildcard "*"), their values are reconciled as follows:

  • If fontFamily is set and weightedFontFamily is not, the value of fontFamily is applied with weight 400 ("normal").
  • If both fields are set, the value of fontFamily must match that of weightedFontFamily#fontFamily. If so, the font family and weight of weightedFontFamily is applied. Otherwise, a 400 bad request error is returned.
  • If weightedFontFamily is set and fontFamily is not, the font family and weight of weightedFontFamily is applied.
  • If neither field is set, the font family and weight of the text inherit from the parent. Note that these properties cannot inherit separately from each other.

If an update request specifies values for both weightedFontFamily and bold, the weightedFontFamily is applied first, then bold.

If weightedFontFamily#weight is not set, it defaults to 400.

If weightedFontFamily is set, then weightedFontFamily#fontFamily must also be set with a non-empty value. Otherwise, a 400 bad request error is returned.

OptionalColor

A color that can either be fully opaque or fully transparent.

JSON representation
{
  "opaqueColor": {
    object (OpaqueColor)
  }
}
Fields
opaqueColor

object (OpaqueColor)

If set, this will be used as an opaque color. If unset, this represents a transparent color.

BaselineOffset

The ways in which text can be vertically offset from its normal position.

Enums
BASELINE_OFFSET_UNSPECIFIED The text's baseline offset is inherited from the parent.
NONE The text is not vertically offset.
SUPERSCRIPT The text is vertically offset upwards (superscript).
SUBSCRIPT The text is vertically offset downwards (subscript).

WeightedFontFamily

Represents a font family and weight used to style a TextRun.

JSON representation
{
  "fontFamily": string,
  "weight": integer
}
Fields
fontFamily

string

The font family of the text.

The font family can be any font from the Font menu in Slides or from Google Fonts. If the font name is unrecognized, the text is rendered in Arial.

weight

integer

The rendered weight of the text. This field can have any value that is a multiple of 100 between 100 and 900, inclusive. This range corresponds to the numerical values described in the CSS 2.1 Specification, section 15.6, with non-numerical values disallowed. Weights greater than or equal to 700 are considered bold, and weights less than 700 are not bold. The default value is 400 ("normal").

TextRun

A TextElement kind that represents a run of text that all has the same styling.

JSON representation
{
  "content": string,
  "style": {
    object (TextStyle)
  }
}
Fields
content

string

The text of this run.

style

object (TextStyle)

The styling applied to this run.

AutoText

A TextElement kind that represents auto text.

JSON representation
{
  "type": enum (Type),
  "content": string,
  "style": {
    object (TextStyle)
  }
}
Fields
type

enum (Type)

The type of this auto text.

content

string

The rendered content of this auto text, if available.

style

object (TextStyle)

The styling applied to this auto text.

Type

The types of auto text

Enums
TYPE_UNSPECIFIED An unspecified autotext type.
SLIDE_NUMBER Type for autotext that represents the current slide number.

List

A List describes the look and feel of bullets belonging to paragraphs associated with a list. A paragraph that is part of a list has an implicit reference to that list's ID.

JSON representation
{
  "listId": string,
  "nestingLevel": {
    integer: {
      object (NestingLevel)
    },
    ...
  }
}
Fields
listId

string

The ID of the list.

nestingLevel

map (key: integer, value: object ( NestingLevel))

A map of nesting levels to the properties of bullets at the associated level. A list has at most nine levels of nesting, so the possible values for the keys of this map are 0 through 8, inclusive.

NestingLevel

Contains properties describing the look and feel of a list bullet at a given level of nesting.

JSON representation
{
  "bulletStyle": {
    object (TextStyle)
  }
}
Fields
bulletStyle

object (TextStyle)

The style of a bullet at this level of nesting.