Class TextParagraph
文本段落
用于显示文本且支持基本 HTML 格式的 widget。
适用于 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
- 此对象,用于链式调用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-01-30。
[null,null,["最后更新时间 (UTC):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"]]