【问题标题】:How to make Card Header Title bold in Gmail Add-on?如何在 Gmail 插件中使卡片标题标题加粗?
【发布时间】:2019-11-14 11:25:27
【问题描述】:

如何在 Gmail 插件中使卡片标题标题加粗?我试过了,但它不起作用:

function mainCardBuild(content) {
    return CardService.newCardBuilder()
        .setHeader(
            CardService.newCardHeader().setTitle('<b> MY TITLE </b>')) //doesn`t work bold
        .addSection(content)
        .build();
}

我确信我们有机会这样做,因为我在 Slack Add-on 中看到了它。 Bold card header in Slack

【问题讨论】:

    标签: google-apps-script google-apps gmail-addons google-apps-script-addon


    【解决方案1】:

    您不能在标题中插入 HTML,但可以在文本段落中插入基本 HTML(请参阅:Informational widgetssupported text formatting)。 您的代码可能如下所示:

    function mainCardBuild(content) {
        var boldHeaderSection = CardService.newCardSection()
          .addWidget(CardService.newTextParagraph().setText('<b>MY TITLE</b>'));
        return CardService.newCardBuilder()
            .addSection(boldHeaderSection)
            .addSection(content)
            .build();
    }
    

    如果您需要进行更多自定义,我建议您查看以下示例,该示例使用 HTML 创建视图 Translate Add-on Quickstart

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-13
      • 2017-05-27
      • 1970-01-01
      • 2011-01-20
      • 1970-01-01
      • 2019-04-16
      相关资源
      最近更新 更多