Class StyledText

StyledText

文字元素,可設定粗體、斜體和顏色等樣式。

僅適用於擴充 Google Workspace Studio 的 Google Workspace 外掛程式。

用法範例:

const styledText = AddOnsResponseService.newStyledText()
  .setText("Styled Text!")
  .addStyle(AddOnsResponseService.TextStyle.ITALIC)
  .addStyle(AddOnsResponseService.TextStyle.UNDERLINE)
  .setFontWeight(AddOnsResponseService.FontWeight.BOLD)
  .setColor(
    AddOnsResponseService.newColor()
      .setRed(0.1)
      .setBlue(0.3)
      .setGreen(0.1)
      .setAlpha(0.78)
  );

方法

方法傳回類型簡短說明
addStyle(style)StyledText設定樣式文字的樣式,可將多種樣式套用至單一的樣式文字。
setColor(color)StyledText設定樣式文字的顏色。
setFontWeight(fontWeight)StyledText設定樣式文字的字型粗細。
setText(text)StyledText設定樣式文字的主要內容。

內容詳盡的說明文件

addStyle(style)

設定樣式文字的樣式,可將多種樣式套用至單一的樣式文字。

參數

名稱類型說明
styleTextStyle樣式文字的 TextStyle

回攻員

StyledText - 這個樣式化文字物件,用於鏈結。


setColor(color)

設定樣式文字的顏色。

參數

名稱類型說明
colorColor樣式文字的 Color

回攻員

StyledText - 這個樣式化文字物件,用於鏈結。


setFontWeight(fontWeight)

設定樣式文字的字型粗細。

參數

名稱類型說明
fontWeightFontWeight樣式文字的 FontWeight

回攻員

StyledText:這個樣式化文字物件,用於串連。


setText(text)

設定樣式文字的主要內容。

參數

名稱類型說明
textString樣式文字中的簡訊。

回攻員

StyledText:這個樣式化文字物件,用於串連。