Class TextParagraph
文字段落可顯示文字且支援基本 HTML 格式的小工具。
適用於 Google Workspace 外掛程式和 Google Chat 應用程式。
const textParagraph = CardService.newTextParagraph().setText(
'This is a text paragraph widget. Multiple lines are allowed if needed.',
);
內容詳盡的說明文件
setMaxLines(maxLines)
設定小工具中顯示的文字行數上限。如果文字超過指定的最大行數,系統會隱藏超出部分,並顯示「顯示更多」按鈕。如果文字等於或短於指定的最大行數,系統就不會顯示「顯示更多」按鈕。
適用於 Google Chat 應用程式。在 Google Workspace 外掛程式的開發人員預覽版中。
const textParagraph =
CardService.newTextParagraph()
.setText(
'This is a text paragraph widget. Multiple lines are allowed if needed.',
)
.setMaxLines(1);
參數
名稱 | 類型 | 說明 |
maxLines | Integer | 顯示的文字行數上限。 |
回攻員
TextParagraph
:這個物件用於鏈結。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-01-30 (世界標準時間)。
[null,null,["上次更新時間:2025-01-30 (世界標準時間)。"],[[["The `TextParagraph` widget displays text with basic HTML formatting support."],["It is usable in Google Workspace Add-ons and Google Chat apps."],["Developers can set the displayed text using the `setText()` method and can chain additional methods for further customization."],["The `setText()` method requires a string argument representing the desired text content."]]],["The `TextParagraph` widget displays text with basic HTML formatting in Google Workspace add-ons and Google Chat apps. Key actions include `setText(text)` to define the displayed text and `setMaxLines(maxLines)` to limit the visible lines; exceeding this limit adds a \"show more\" button. `setMaxLines` is in developer preview for Google Workspace and available for Google Chat, whereas `setText` is fully available. Both methods return the `TextParagraph` object to enable method chaining.\n"]]