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 — This ParagraphStyle, for chaining.

授權

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

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

setIndentFirstLine(indent)

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

參數

名稱類型說明
indentNumber要設定的縮排。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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

setIndentStart(indent)

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

參數

名稱類型說明
indentNumber要設定的縮排。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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

setLineSpacing(spacing)

設定行距。

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

參數

名稱類型說明
spacingNumber要設定的間距。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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

setParagraphAlignment(alignment)

設定 TextRange 中段落的 ParagraphAlignment

參數

名稱類型說明
alignmentParagraphAlignment要設定的對齊方式。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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

setSpaceAbove(space)

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

參數

名稱類型說明
spaceNumber要設定的空間。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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

setSpaceBelow(space)

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

參數

名稱類型說明
spaceNumber下方空間可供設定。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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

setSpacingMode(mode)

設定 TextRange 中段落的 SpacingMode

參數

名稱類型說明
modeSpacingMode要設定的間距模式。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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

setTextDirection(direction)

設定 TextRange 中段落的 TextDirection

參數

名稱類型說明
directionTextDirection要設定的文字方向。

回攻員

ParagraphStyle — This ParagraphStyle, for chaining.

授權

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

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