顯示文字並支援基本 HTML 格式的小工具。
適用於 Google Workspace 外掛程式和 Google Chat 應用程式。
const textParagraph = CardService.newTextParagraph().setText( 'This is a text paragraph widget. Multiple lines are allowed if needed.', );
方法
| 方法 | 傳回類型 | 簡短說明 |
|---|---|---|
add | Widget | 新增可在小工具上執行的事件動作。 |
set | Widget | 設定指派的專屬 ID,用於識別要變動的小工具。 |
set | Text | 設定要在小工具中顯示的文字行數上限。 |
set | Text | 設定段落的文字。 |
set | Widget | 設定小工具的顯示設定。 |
內容詳盡的說明文件
add Event Action(eventAction)
set Id(id)
設定指派的專屬 ID,用於識別要變動的小工具。外掛程式僅支援小工具突變。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
id | String | 小工具的 ID,最多 64 個字元,格式為 `[a-zA-Z0-9-]+`。 |
回攻員
Widget - 這個物件,用於鏈結。
set Max Lines(maxLines)
設定要在小工具中顯示的文字行數上限。如果文字超過指定行數上限,多餘的內容會隱藏在「顯示更多」按鈕後方。如果文字的行數等於或少於指定上限,系統就不會顯示「顯示更多」按鈕。
適用於 Google Chat 擴充應用程式。Google Workspace 外掛程式的開發人員預覽版。
const textParagraph = CardService.newTextParagraph() .setText( 'This is a text paragraph widget. Multiple lines are allowed if needed.', ) .setMaxLines(1);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
max | Integer | 顯示的文字行數上限。 |
回攻員
Text - 這個物件,用於鏈結。