Class ParagraphStyle  |  Apps Script  |  Google for Developers (original) (raw)

Class ParagraphStyle

Stay organized with collections Save and categorize content based on your preferences.

ParagraphStyle

The styles of text that apply to entire paragraphs.

Read methods in this class return null if the corresponding [TextRange](/apps-script/reference/slides/text-range) spans multiple paragraphs, and those paragraphs have different values for the read method being called. To avoid this, query for paragraph styles using the [TextRange](/apps-script/reference/slides/text-range) returned by the [Paragraph.getRange()](/apps-script/reference/slides/paragraph#getRange%28%29) method.

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

Detailed documentation

getIndentEnd()

Returns the text end indentation for paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points, or null 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

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


getIndentFirstLine()

Returns the indentation for the first line of paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points, ornull if there are multiple paragraph styles on the given text.

Return

Number

Authorization

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


getIndentStart()

Returns the text start indentation for paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points, or null 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

Authorization

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


getLineSpacing()

Returns the line spacing, or null if there are multiple paragraph styles on the given text.

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

Return

Number

Authorization

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


getParagraphAlignment()

Returns the [ParagraphAlignment](/apps-script/reference/slides/paragraph-alignment) of paragraphs in the [TextRange](/apps-script/reference/slides/text-range), or nullif there are multiple paragraph styles on the given text.

Return

[ParagraphAlignment](/apps-script/reference/slides/paragraph-alignment)

Authorization

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


getSpaceAbove()

Returns the extra space above paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points, or null if there are multiple paragraph styles on the given text.

Return

Number

Authorization

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


getSpaceBelow()

Returns the extra space below paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points, or null if there are multiple paragraph styles on the given text.

Return

Number

Authorization

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


getSpacingMode()

Returns the [SpacingMode](/apps-script/reference/slides/spacing-mode) for paragraphs in the [TextRange](/apps-script/reference/slides/text-range), or null if there are multiple paragraph styles on the given text.

Return

[SpacingMode](/apps-script/reference/slides/spacing-mode)

Authorization

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


getTextDirection()

Returns the [TextDirection](/apps-script/reference/slides/text-direction) for paragraphs in the [TextRange](/apps-script/reference/slides/text-range), or null if there are multiple paragraph styles on the given text.

Return

[TextDirection](/apps-script/reference/slides/text-direction)

Authorization

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


setIndentEnd(indent)

Sets the text end indentation for paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points.

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

Parameters

Name Type Description
indent Number

Return

[ParagraphStyle](#)

Authorization

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


setIndentFirstLine(indent)

Sets the indentation for the first line of paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points.

Parameters

Name Type Description
indent Number

Return

[ParagraphStyle](#)

Authorization

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


setIndentStart(indent)

Sets the text start indentation for paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points.

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

Parameters

Name Type Description
indent Number

Return

[ParagraphStyle](#)

Authorization

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


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

Name Type Description
spacing Number

Return

[ParagraphStyle](#)

Authorization

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


setParagraphAlignment(alignment)

Sets the [ParagraphAlignment](/apps-script/reference/slides/paragraph-alignment) of paragraphs in the [TextRange](/apps-script/reference/slides/text-range).

Parameters

Name Type Description
alignment ParagraphAlignment

Return

[ParagraphStyle](#)

Authorization

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


setSpaceAbove(space)

Sets the extra space above paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points.

Parameters

Name Type Description
space Number

Return

[ParagraphStyle](#)

Authorization

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


setSpaceBelow(space)

Sets the extra space below paragraphs in the [TextRange](/apps-script/reference/slides/text-range) in points.

Parameters

Name Type Description
space Number

Return

[ParagraphStyle](#)

Authorization

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


setSpacingMode(mode)

Sets the [SpacingMode](/apps-script/reference/slides/spacing-mode) for paragraphs in the [TextRange](/apps-script/reference/slides/text-range).

Parameters

Name Type Description
mode SpacingMode

Return

[ParagraphStyle](#)

Authorization

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


setTextDirection(direction)

Sets the [TextDirection](/apps-script/reference/slides/text-direction) for paragraphs in the [TextRange](/apps-script/reference/slides/text-range).

Parameters

Name Type Description
direction TextDirection

Return

[ParagraphStyle](#)

Authorization

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

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

Last updated 2024-12-02 UTC.