Class ParagraphStyle

段落樣式

套用至整段文字的樣式。

如果對應的 TextRange 跨越多個段落,且這些段落的讀取方法呼叫值不同,這個類別中的讀取方法就會傳回 null。為避免發生這種情況,請使用 Paragraph.getRange() 方法傳回的 TextRange 查詢段落樣式。

如果您使用可編輯文字在圖案內顯示方式的方法,系統會停用套用至段落樣式的任何自動調整設定。

方法

方法傳回類型簡短說明
getIndentEnd()Number|null傳回 TextRange 中段落的文字結尾縮排 (以點為單位),如果指定文字有多種段落樣式,則傳回 null
getIndentFirstLine()Number|null傳回 TextRange 中段落首行的縮排點數,或是在指定文字有多種段落樣式時傳回 null
getIndentStart()Number|null傳回 TextRange 中段落的文字開頭縮排 (以點為單位),或是在指定文字有多種段落樣式時傳回 null
getLineSpacing()Number|null傳回行距,如果指定文字有多種段落樣式,則傳回 null
getParagraphAlignment()ParagraphAlignment|null傳回 TextRange 中段落的 ParagraphAlignment,或是在指定文字有多種段落樣式時傳回 null
getSpaceAbove()Number|null傳回 TextRange 中段落上方的額外空間 (以點為單位),或如果指定文字有多個段落樣式,則傳回 null
getSpaceBelow()Number|null以點為單位,傳回 TextRange 中段落下方的額外空間,或是在指定文字有多個段落樣式時傳回 null
getSpacingMode()SpacingMode|null傳回 TextRange 中段落的 SpacingMode,或傳回 null (如果指定文字有多種段落樣式)。
getTextDirection()TextDirection|null傳回 TextRange 中段落的 TextDirection,或傳回 null (如果指定文字有多種段落樣式)。
setIndentEnd(indent)ParagraphStyle以點為單位,設定 TextRange 中段落的文字結尾縮排。
setIndentFirstLine(indent)ParagraphStyle以點為單位,設定 TextRange 中段落首行的縮排。
setIndentStart(indent)ParagraphStyle以點為單位,設定 TextRange 中段落的文字起始縮排。
setLineSpacing(spacing)ParagraphStyle設定行距。
setParagraphAlignment(alignment)ParagraphStyle設定 TextRange 中段落的 ParagraphAlignment
setSpaceAbove(space)ParagraphStyle以點為單位,設定 TextRange 中段落上方的額外空間。
setSpaceBelow(space)ParagraphStyle以點為單位,設定 TextRange 中段落下方的額外空間。
setSpacingMode(mode)ParagraphStyle設定 TextRange 中段落的 SpacingMode
setTextDirection(direction)ParagraphStyle設定 TextRange 中段落的 TextDirection

內容詳盡的說明文件

getIndentEnd()

傳回 TextRange 中段落的文字結尾縮排 (以點為單位),如果指定文字有多種段落樣式,則傳回 null

對應文字結尾的側邊會根據目前的文字方向而定。

回攻員

Number|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getIndentFirstLine()

傳回 TextRange 中段落首行的縮排點數,或是在指定文字有多種段落樣式時傳回 null

回攻員

Number|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getIndentStart()

傳回 TextRange 中段落的文字開頭縮排 (以點為單位),如果指定文字有多種段落樣式,則傳回 null

與文字開頭對應的側邊會根據目前的文字方向而定。

回攻員

Number|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getLineSpacing()

傳回行距,如果指定文字有多種段落樣式,則傳回 null

這個值對應於行間距,以正常值的百分比表示。正常會以 100.0 表示。

回攻員

Number|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getParagraphAlignment()

傳回 TextRange 中段落的 ParagraphAlignment,或是在指定文字有多種段落樣式時傳回 null

回攻員

ParagraphAlignment|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getSpaceAbove()

傳回 TextRange 中段落上方的額外空間 (以點為單位),或如果指定文字有多個段落樣式,則傳回 null

回攻員

Number|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getSpaceBelow()

以點為單位,傳回 TextRange 中段落下方的額外空間,或是在指定文字有多個段落樣式時傳回 null

回攻員

Number|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getSpacingMode()

傳回 TextRange 中段落的 SpacingMode,或傳回 null (如果指定文字有多種段落樣式)。

回攻員

SpacingMode|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

getTextDirection()

傳回 TextRange 中段落的 TextDirection,或傳回 null (如果指定文字有多種段落樣式)。

回攻員

TextDirection|null

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setIndentEnd(indent)

以點為單位,設定 TextRange 中段落的文字結尾縮排。

對應文字結尾的側邊會根據目前的文字方向而定。

參數

名稱類型說明
indentNumber

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setIndentFirstLine(indent)

以點為單位,設定 TextRange 中段落首行的縮排。

參數

名稱類型說明
indentNumber

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setIndentStart(indent)

設定 TextRange 中段落的文字起始縮排 (以點為單位)。

與文字開頭對應的側邊會根據目前的文字方向而定。

參數

名稱類型說明
indentNumber

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setLineSpacing(spacing)

設定行距。

這個值對應於行間距,以正常值的百分比表示。正常會以 100.0 表示。

參數

名稱類型說明
spacingNumber

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setParagraphAlignment(alignment)

設定 TextRange 中段落的 ParagraphAlignment

參數

名稱類型說明
alignmentParagraphAlignment

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setSpaceAbove(space)

以點為單位,設定 TextRange 中段落上方的額外空間。

參數

名稱類型說明
spaceNumber

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setSpaceBelow(space)

以點為單位,設定 TextRange 中段落下方的額外空間。

參數

名稱類型說明
spaceNumber

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setSpacingMode(mode)

設定 TextRange 中段落的 SpacingMode

參數

名稱類型說明
modeSpacingMode

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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

setTextDirection(direction)

設定 TextRange 中段落的 TextDirection

參數

名稱類型說明
directionTextDirection

回攻員

ParagraphStyle

授權

使用這個方法的指令碼需要一或多個下列範圍的授權:

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