Class ParagraphStyle

  • ParagraphStyle applies text styles to entire paragraphs.

  • Reading methods for ParagraphStyle return null if the TextRange spans paragraphs with different styles.

  • To avoid issues with reading styles across multiple paragraphs, query using the TextRange returned by Paragraph.getRange().

  • Editing text fit within a shape deactivates any autofit settings on paragraph styles.

  • ParagraphStyle provides methods to get and set indentation, line spacing, alignment, spacing above and below, spacing mode, and text direction.

ParagraphStyle

The styles of text that apply to entire paragraphs.

Read methods in this class returnnull if the correspondingTextRange spansmultiple paragraphs, and those paragraphs have different values for the read method being called.To avoid this, query for paragraph styles using theTextRange returned by theParagraph.getRange() method.

If you use methods that edit how text fits within a shape, any autofit settings applied to theparagraph styles are deactivated.

Methods

MethodReturn typeBrief description
getIndentEnd()Number|nullReturns the text end indentation for paragraphs in theTextRange in points, ornull if there are multiple paragraph styles on the given text.
getIndentFirstLine()Number|nullReturns the indentation for the first line of paragraphs in theTextRange in points, ornull if there are multiple paragraph styles on the given text.
getIndentStart()Number|nullReturns the text start indentation for paragraphs in theTextRange in points, ornull if there are multiple paragraph styles on the given text.
getLineSpacing()Number|nullReturns the line spacing, ornull if there are multiple paragraph styles on the giventext.
getParagraphAlignment()ParagraphAlignment|nullReturns theParagraphAlignment of paragraphs in theTextRange, ornullif there are multiple paragraph styles on the given text.
getSpaceAbove()Number|nullReturns the extra space above paragraphs in theTextRange in points, ornull ifthere are multiple paragraph styles on the given text.
getSpaceBelow()Number|nullReturns the extra space below paragraphs in theTextRange in points, ornull ifthere are multiple paragraph styles on the given text.
getSpacingMode()SpacingMode|nullReturns theSpacingMode for paragraphs in theTextRange, ornull ifthere are multiple paragraph styles on the given text.
getTextDirection()TextDirection|nullReturns theTextDirection for paragraphs in theTextRange, ornull ifthere are multiple paragraph styles on the given text.
setIndentEnd(indent)ParagraphStyleSets the text end indentation for paragraphs in theTextRange in points.
setIndentFirstLine(indent)ParagraphStyleSets the indentation for the first line of paragraphs in theTextRange in points.
setIndentStart(indent)ParagraphStyleSets the text start indentation for paragraphs in theTextRange in points.
setLineSpacing(spacing)ParagraphStyleSets the line spacing.
setParagraphAlignment(alignment)ParagraphStyleSets theParagraphAlignment of paragraphs in theTextRange.
setSpaceAbove(space)ParagraphStyleSets the extra space above paragraphs in theTextRange in points.
setSpaceBelow(space)ParagraphStyleSets the extra space below paragraphs in theTextRange in points.
setSpacingMode(mode)ParagraphStyleSets theSpacingMode for paragraphs in theTextRange.
setTextDirection(direction)ParagraphStyleSets theTextDirection for paragraphs in theTextRange.

Detailed documentation

getIndentEnd()

Returns the text end indentation for paragraphs in theTextRange in points, ornull if there are multiple paragraph styles on the given text.

The side that corresponds to the end of the text is based on the current text direction.

Return

Number|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getIndentFirstLine()

Returns the indentation for the first line of paragraphs in theTextRange in points, ornull if there are multiple paragraph styles on the given text.

Return

Number|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getIndentStart()

Returns the text start indentation for paragraphs in theTextRange in points, ornull if there are multiple paragraph styles on the given text.

The side that corresponds to the start of the text is based on the current text direction.

Return

Number|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getLineSpacing()

Returns the line spacing, ornull if there are multiple paragraph styles on the giventext.

This is a value that corresponds to the space between lines, as a percentage of normal.Normal is represented as 100.0.

Return

Number|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getParagraphAlignment()

Returns theParagraphAlignment of paragraphs in theTextRange, ornullif there are multiple paragraph styles on the given text.

Return

ParagraphAlignment|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getSpaceAbove()

Returns the extra space above paragraphs in theTextRange in points, ornull ifthere are multiple paragraph styles on the given text.

Return

Number|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getSpaceBelow()

Returns the extra space below paragraphs in theTextRange in points, ornull ifthere are multiple paragraph styles on the given text.

Return

Number|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getSpacingMode()

Returns theSpacingMode for paragraphs in theTextRange, ornull ifthere are multiple paragraph styles on the given text.

Return

SpacingMode|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

getTextDirection()

Returns theTextDirection for paragraphs in theTextRange, ornull ifthere are multiple paragraph styles on the given text.

Return

TextDirection|null

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setIndentEnd(indent)

Sets the text end indentation for paragraphs in theTextRange in points.

The side that corresponds to the end of the text is based on the current text direction.

Parameters

NameTypeDescription
indentNumber

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setIndentFirstLine(indent)

Sets the indentation for the first line of paragraphs in theTextRange in points.

Parameters

NameTypeDescription
indentNumber

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setIndentStart(indent)

Sets the text start indentation for paragraphs in theTextRange in points.

The side that corresponds to the start of the text is based on the current text direction.

Parameters

NameTypeDescription
indentNumber

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setLineSpacing(spacing)

Sets the line spacing.

This is a value that corresponds to the space between lines, as a percentage of normal.Normal is represented as 100.0.

Parameters

NameTypeDescription
spacingNumber

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setParagraphAlignment(alignment)

Sets theParagraphAlignment of paragraphs in theTextRange.

Parameters

NameTypeDescription
alignmentParagraphAlignment

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setSpaceAbove(space)

Sets the extra space above paragraphs in theTextRange in points.

Parameters

NameTypeDescription
spaceNumber

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setSpaceBelow(space)

Sets the extra space below paragraphs in theTextRange in points.

Parameters

NameTypeDescription
spaceNumber

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setSpacingMode(mode)

Sets theSpacingMode for paragraphs in theTextRange.

Parameters

NameTypeDescription
modeSpacingMode

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

setTextDirection(direction)

Sets theTextDirection for paragraphs in theTextRange.

Parameters

NameTypeDescription
directionTextDirection

Return

ParagraphStyle

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/presentations.currentonly
  • https://www.googleapis.com/auth/presentations

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.